/*
 * codex-backend
 *
 * codex-backend
 *
 * The version of the OpenAPI document: 0.0.1
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::Deserialize;
use serde::Serialize;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RateLimitStatusDetails {
    #[serde(rename = "allowed")]
    pub allowed: bool,
    #[serde(rename = "limit_reached")]
    pub limit_reached: bool,
    #[serde(
        rename = "primary_window",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_window: Option<Option<Box<models::RateLimitWindowSnapshot>>>,
    #[serde(
        rename = "secondary_window",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub secondary_window: Option<Option<Box<models::RateLimitWindowSnapshot>>>,
}

impl RateLimitStatusDetails {
    pub fn new(allowed: bool, limit_reached: bool) -> RateLimitStatusDetails {
        RateLimitStatusDetails {
            allowed,
            limit_reached,
            primary_window: None,
            secondary_window: None,
        }
    }
}
