// !!!
// WARNING: This file is autogenerated
// Only modify code within MANUAL() sections
// or your changes may be overwritten later!
// !!!

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProjectMetric {
    pub count: u32,
    pub metric_type: std::option::Option<ProjectMetricMetricType>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct MetricsRequest {}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MetricsResponse {
    pub request_id: String,
    pub project_id: String,
    pub metrics: std::vec::Vec<ProjectMetric>,
    #[serde(with = "http_serde::status_code")]
    pub status_code: http::StatusCode,
}

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub enum ProjectMetricMetricType {
    #[serde(rename = "unknown")]
    #[default]
    UNKNOWN,
    #[serde(rename = "user_count")]
    USERCOUNT,
    #[serde(rename = "organization_count")]
    ORGANIZATIONCOUNT,
    #[serde(rename = "member_count")]
    MEMBERCOUNT,
    #[serde(rename = "m2m_client_count")]
    M2MCLIENTCOUNT,
}

pub struct Project {
    http_client: crate::client::Client,
}

impl Project {
    pub fn new(http_client: crate::client::Client) -> Self {
        Self {
            http_client: http_client.clone(),
        }
    }

    pub async fn metrics(&self, body: MetricsRequest) -> crate::Result<MetricsResponse> {
        let path = String::from("/v1/projects/metrics");
        self.http_client
            .send(crate::Request {
                method: http::Method::GET,
                path,
                body,
            })
            .await
    }
}
