// SPDX-FileCopyrightText: Politik im Blick developers
// SPDX-FileCopyrightText: Wolfgang Silbermayr <wolfgang@silbermayr.at>
//
// SPDX-License-Identifier: AGPL-3.0-or-later OR EUPL-1.2

use oparl_types::{DateTime, Name};
use pib_service_core_types::{AgendaItemId, BodyId, MeetingId};
use serde::{Deserialize, Serialize};

pub mod get;
pub mod post;

pub mod by_id;

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct AgendaItem {
    pub id: AgendaItemId,
    pub created: DateTime,
    pub modified: DateTime,

    pub body_id: BodyId,
    pub meeting_id: MeetingId,
    pub number: Option<String>,
    pub order: u32,
    pub name: Option<Name>,
    pub public: Option<bool>,
    pub result: Option<String>,
    pub resolution_text: Option<String>,
    pub start: Option<DateTime>,
    pub end: Option<DateTime>,
    pub keyword: Vec<String>,
    pub license: Option<String>,
    pub web: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct NewAgendaItem {
    pub number: Option<String>,
    pub order: u32,
    pub name: Option<Name>,
    pub public: Option<bool>,
    pub result: Option<String>,
    pub resolution_text: Option<String>,
    pub start: Option<DateTime>,
    pub end: Option<DateTime>,
    pub keyword: Vec<String>,
    pub license: Option<String>,
    pub web: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct UpdateAgendaItem {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub number: Option<Option<String>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub order: Option<u32>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<Option<Name>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub public: Option<Option<bool>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub result: Option<Option<String>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub resolution_text: Option<Option<String>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub start: Option<Option<DateTime>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub end: Option<Option<DateTime>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub keyword: Option<Vec<String>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub license: Option<Option<String>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub web: Option<Option<String>>,
}
