use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct Squad { pub id: String, pub club_id: String, pub name: String, pub formation: String, pub created_at: String, pub updated_at: String, } impl Squad { pub fn new( club_id: impl Into, name: impl Into, formation: impl Into, ) -> Self { let now = chrono::Utc::now().to_rfc3339(); Self { id: Uuid::new_v4().to_string(), club_id: club_id.into(), name: name.into(), formation: formation.into(), created_at: now.clone(), updated_at: now, } } } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct SquadPlayer { pub id: String, pub squad_id: String, pub owned_card_id: String, pub position_index: i64, pub is_captain: bool, pub is_on_bench: bool, } #[derive(Debug, Deserialize)] pub struct SaveSquadRequest { pub name: Option, pub formation: Option, pub players: Vec, } #[derive(Debug, Deserialize)] pub struct SquadPlayerInput { pub owned_card_id: String, pub position_index: i64, pub is_captain: bool, pub is_on_bench: bool, }