use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::models::{Author, PatId, PatRequestId};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct OrgPersonalAccessToken {
pub id: PatId,
pub owner: Author,
#[serde(default)]
pub repository_selection: Option<String>,
#[serde(default)]
pub repositories_url: Option<String>,
#[serde(default)]
pub token_expired: Option<bool>,
#[serde(default)]
pub token_expires_at: Option<DateTime<Utc>>,
#[serde(default)]
pub token_last_used_at: Option<DateTime<Utc>>,
#[serde(default)]
pub access_granted_at: Option<DateTime<Utc>>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct OrgPersonalAccessTokenRequest {
pub id: PatRequestId,
pub owner: Author,
#[serde(default)]
pub repository_selection: Option<String>,
#[serde(default)]
pub repositories_url: Option<String>,
#[serde(default)]
pub token_id: Option<u64>,
#[serde(default)]
pub token_name: Option<String>,
#[serde(default)]
pub token_expired: Option<bool>,
#[serde(default)]
pub token_expires_at: Option<DateTime<Utc>>,
#[serde(default)]
pub token_last_used_at: Option<DateTime<Utc>>,
#[serde(default)]
pub created_at: Option<DateTime<Utc>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PatAction {
Revoke,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PatReviewDecision {
Approve,
Deny,
}