use redis::AsyncCommands;
use uuid::Uuid;

pub mod merge;
pub mod review;
pub mod review_comment;
pub mod review_request;

pub mod pull_request;

// Re-export types
pub use merge::{MergeAnalysisResponse, MergeConflictResponse, MergeRequest, MergeResponse};
pub use pull_request::{
    PrCommitResponse, PrCommitsListResponse, PullRequestCreateRequest, PullRequestListResponse,
    PullRequestResponse, PullRequestSummaryResponse, PullRequestUpdateRequest,
};
pub use review::{ReviewListResponse, ReviewResponse, ReviewSubmitRequest, ReviewUpdateRequest};
pub use review_comment::{
    ReviewCommentCreateRequest, ReviewCommentListQuery, ReviewCommentListResponse,
    ReviewCommentReplyRequest, ReviewCommentResponse, ReviewCommentUpdateRequest,
};
pub use review_request::{
    ReviewRequestCreateRequest, ReviewRequestListResponse, ReviewRequestResponse,
};

pub(crate) async fn invalidate_pr_cache(cache: &db::cache::AppCache, repo_id: Uuid, number: i64) {
    if let Ok(mut conn) = cache.conn().await {
        let key = format!("pr:get:{}:{}", repo_id, number);
        let _: Option<()> = conn.del::<_, ()>(key).await.ok();
    }
}
