/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.  ## Authentication  The JSON management API under `/api/v1/_*` accepts **API tokens only as `Authorization: Bearer <token>`**. This is the canonical scheme for programmatic access; JWTs issued by the login flow also use `Bearer`. HTTP Basic credentials on `/api/v1/_*` are validated *only* as a real `username:password` login — the password half is **not** retried as an API token. A request to `/api/v1/_*` that sends an API token in the password field of Basic auth therefore returns `401 AUTH_ERROR`; switch to `Authorization: Bearer <token>`.  Format (package-manager) endpoints such as `/v2/_*` (OCI), `/incus/_*`, `/debian/_*`, and the language registries are intentionally more permissive for client compatibility: in addition to Bearer, they accept HTTP **Basic** auth with the API token supplied in the *password* field (any username), matching the `pip` netrc / Artifactory-style `token:<api_token>` convention used by package managers that cannot send a Bearer header. This Basic-with-token fallback applies to format endpoints only, never to `/api/v1/_*`.
 *
 * The version of the OpenAPI document: 1.4.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateRepositoryRequest {
    /// Alias for `is_public`. When set to true, anonymous users can download artifacts without authentication. Useful for remote (pull-through cache) repositories that proxy public upstream registries. Write operations (upload, delete) still require authentication regardless of this setting. If both `is_public` and `allow_anonymous_access` are provided, `allow_anonymous_access` takes precedence.
    #[serde(rename = "allow_anonymous_access", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub allow_anonymous_access: Option<Option<bool>>,
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    /// Update the Cargo index upstream URL (stored in `repository_config`). When provided, upserts the `index_upstream_url` key for this repository.
    #[serde(rename = "index_upstream_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub index_upstream_url: Option<Option<String>>,
    #[serde(rename = "is_public", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub is_public: Option<Option<bool>>,
    #[serde(rename = "key", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub key: Option<Option<String>>,
    #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub name: Option<Option<String>>,
    /// When provided, enables/disables the `promotion_only` policy for this repository (admin-only). When omitted, the flag is left unchanged.
    #[serde(rename = "promotion_only", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub promotion_only: Option<Option<bool>>,
    /// Update the PyPI simple-index prefix (stored in `repository_config` under `pypi_upstream_index_path`). Pass `\"\"` for flat CDN layout, `\"simple\"` to restore the PEP 503 default, or any other non-empty string for a custom prefix. Only meaningful for PyPI / Poetry / Conda Remote repositories.
    #[serde(rename = "pypi_upstream_index_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub pypi_upstream_index_path: Option<Option<String>>,
    /// Quarantine hold duration in minutes for this repository. Stored in `repository_config` under `quarantine_duration_minutes`.
    #[serde(rename = "quarantine_duration_minutes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub quarantine_duration_minutes: Option<Option<i64>>,
    /// Enable or disable quarantine period for this repository. When enabled, newly uploaded artifacts are held until scanned. Stored in `repository_config` under `quarantine_enabled`.
    #[serde(rename = "quarantine_enabled", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub quarantine_enabled: Option<Option<bool>>,
    #[serde(rename = "quota_bytes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub quota_bytes: Option<Option<i64>>,
    /// Link this staging repository to a release (local) repository. Promotions from this staging repo will default to the linked release repo, and promotions to any other repo will be rejected. Pass an empty string to remove the link. Stored in `repository_config` under `release_repository_id`.
    #[serde(rename = "release_repository_key", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub release_repository_key: Option<Option<String>>,
}

impl UpdateRepositoryRequest {
    pub fn new() -> UpdateRepositoryRequest {
        UpdateRepositoryRequest {
            allow_anonymous_access: None,
            description: None,
            index_upstream_url: None,
            is_public: None,
            key: None,
            name: None,
            promotion_only: None,
            pypi_upstream_index_path: None,
            quarantine_duration_minutes: None,
            quarantine_enabled: None,
            quota_bytes: None,
            release_repository_key: None,
        }
    }
}

