--
-- Copyright (c) 2024 SUSE LLC
--
-- This software is licensed to you under the GNU General Public License,
-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-- along with this software; if not, see
-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
--

COMMENT ON TABLE CoCoAttestation
  IS 'The list of Confidential Compute Attestations performed on a system';

COMMENT ON COLUMN CoCoAttestation.mgm_id
  IS 'The id of the BRAND_NAME instance that contains this data';
COMMENT ON COLUMN CoCoAttestation.report_id
  IS 'The id of the report';
COMMENT ON COLUMN CoCoAttestation.system_id
  IS 'The id of the system';
COMMENT ON COLUMN CoCoAttestation.action_id
  IS 'The id of the action that triggered the attestation';
COMMENT ON COLUMN CoCoAttestation.environment_type
  IS 'The type of the environment of the attested system';
COMMENT ON COLUMN CoCoAttestation.status
  IS 'The status of the attestation';
COMMENT ON COLUMN CoCoAttestation.create_time
  IS 'The timestamp when the attestation was started';
COMMENT ON COLUMN CoCoAttestation.pass
  IS 'The number of passed attestation results';
COMMENT ON COLUMN CoCoAttestation.fail
  IS 'The number of failed attestation results';
COMMENT ON COLUMN CoCoAttestation.synced_date
  IS 'The timestamp of when this data was last refreshed.';

ALTER TABLE CoCoAttestation
    ADD CONSTRAINT CoCoAttestation_system_action_fkey FOREIGN KEY (mgm_id, system_id, action_id) REFERENCES SystemAction(mgm_id, system_id, action_id);
