/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SigningConfigResponse {
    #[serde(rename = "key", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub key: Option<Option<Box<models::SigningKeyPublic>>>,
    #[serde(rename = "repository_id")]
    pub repository_id: uuid::Uuid,
    #[serde(rename = "require_signatures")]
    pub require_signatures: bool,
    #[serde(rename = "sign_metadata")]
    pub sign_metadata: bool,
    #[serde(rename = "sign_packages")]
    pub sign_packages: bool,
    #[serde(rename = "signing_key_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub signing_key_id: Option<Option<uuid::Uuid>>,
}

impl SigningConfigResponse {
    pub fn new(repository_id: uuid::Uuid, require_signatures: bool, sign_metadata: bool, sign_packages: bool) -> SigningConfigResponse {
        SigningConfigResponse {
            key: None,
            repository_id,
            require_signatures,
            sign_metadata,
            sign_packages,
            signing_key_id: None,
        }
    }
}

