2023-03-02 23:25:08 +11:00
|
|
|
use serde::{Serialize, Deserialize};
|
2023-03-19 00:04:59 +11:00
|
|
|
use chrono::{DateTime, Utc};
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
pub enum CorpPermission {
|
|
|
|
Holder, // Implies all permissions.
|
|
|
|
Hire,
|
|
|
|
Fire,
|
|
|
|
ChangeJobTitle,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct CorpId(pub i64);
|
2023-03-02 23:25:08 +11:00
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
pub struct Corp {
|
|
|
|
pub name: String,
|
|
|
|
// If true, new members get allow_combat on, and members cannot turn
|
|
|
|
// allow_combat off. This will allow duly authorised corp members to
|
|
|
|
// consent to combat with other corps, and have it apply to members.
|
|
|
|
pub allow_combat_required: bool,
|
2023-03-19 00:04:59 +11:00
|
|
|
pub member_permissions: Vec<CorpPermission>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Corp {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
name: "Unset".to_owned(),
|
|
|
|
allow_combat_required: false,
|
|
|
|
member_permissions: vec!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
pub struct CorpMembership {
|
|
|
|
pub invited_at: Option<DateTime<Utc>>,
|
|
|
|
pub joined_at: Option<DateTime<Utc>>,
|
|
|
|
pub permissions: Vec<CorpPermission>,
|
|
|
|
pub allow_combat: bool,
|
|
|
|
pub job_title: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for CorpMembership {
|
|
|
|
fn default() -> CorpMembership {
|
|
|
|
CorpMembership {
|
|
|
|
invited_at: None,
|
|
|
|
joined_at: None,
|
|
|
|
permissions: vec!(),
|
|
|
|
allow_combat: false,
|
|
|
|
job_title: "Employee".to_owned(),
|
|
|
|
}
|
|
|
|
}
|
2023-03-02 23:25:08 +11:00
|
|
|
}
|