use crate::{DateTimeUtc, RepoId, UserId};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

/// Tracks a review request: a PR author has asked a specific user to review.
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "pull_request_review_request")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub repo: RepoId,
    #[sea_orm(primary_key)]
    pub number: i64,
    #[sea_orm(primary_key)]
    pub reviewer: UserId,
    /// Who requested this review.
    pub requested_by: UserId,
    pub requested_at: DateTimeUtc,
    /// When the reviewer was dismissed (null = still pending).
    pub dismissed_at: Option<DateTimeUtc>,
    /// Who dismissed the request (null if not dismissed).
    pub dismissed_by: Option<UserId>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
