//! `SeaORM` Entity for ActivityPub actors.

use sea_orm::entity::prelude::*;
use serde::Serialize;

#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize)]
#[sea_orm(table_name = "ap_actors")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i64,
    /// The user this actor represents, if any.
    #[sea_orm(unique)]
    pub user_id: Option<i64>,
    /// The repository this actor represents, if any.
    #[sea_orm(unique)]
    pub repo_id: Option<i64>,
    pub private_key_pem: String,
    pub public_key_pem: String,
    pub created_at: DateTimeWithTimeZone,
}

impl ActiveModelBehavior for ActiveModel {}
