use serde::{Deserialize, Serialize};

/// PlanDateInformation : Contains the dates associated with the subscriber and dependents' (if applicable) insurance plan. This information is used to determine their eligibility for benefits. - Most fields contain a single date, but some can contain either a single date or a date range. Each field's documentation specifies its format. - Fields that can contain either a single date or date range include: `plan`, `eligibility`, `planBegin`, `admission`, and `service`. - The provided dates apply to every benefit within the patient's health plan unless specifically noted within a `benefitsInformation.benefitsDateInformation` object. - If the payer sends back date(s) that are different for the subscriber and dependents, Stedi includes only the dates for the dependent in this object and omits the subscriber's date(s). Dependents can have different coverage dates than the subscriber due to qualifying life events, such as starting a new job or passing the age limit for coverage through their parent's plan. - Most payers return either `plan` or `planBegin` and `planEnd`, but the exact dates returned depend on the payer's discretion and the patient's insurance plan. - If the date of service is after the earliest ending `plan`, `eligibility`, `planEnd`, `eligibilityEnd`, `policyEffective`, or `policyExpiration` value, the patient likely doesn't have active coverage.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PlanDateInformation {
    /// Added date. Payers may return this information in the case of retroactive eligibility.
    #[serde(rename = "added", skip_serializing_if = "Option::is_none")]
    pub added: Option<String>,
    /// The admission date or dates.
    #[serde(rename = "admission", skip_serializing_if = "Option::is_none")]
    pub admission: Option<String>,
    /// The benefit date.
    #[serde(rename = "benefit", skip_serializing_if = "Option::is_none")]
    pub benefit: Option<String>,
    /// The benefit begin date.
    #[serde(rename = "benefitBegin", skip_serializing_if = "Option::is_none")]
    pub benefit_begin: Option<String>,
    /// The benefit end date.
    #[serde(rename = "benefitEnd", skip_serializing_if = "Option::is_none")]
    pub benefit_end: Option<String>,
    /// The certification date.
    #[serde(rename = "certification", skip_serializing_if = "Option::is_none")]
    pub certification: Option<String>,
    /// The date when COBRA coverage begins.
    #[serde(rename = "cobraBegin", skip_serializing_if = "Option::is_none")]
    pub cobra_begin: Option<String>,
    /// The date when COBRA coverage ends.
    #[serde(rename = "cobraEnd", skip_serializing_if = "Option::is_none")]
    pub cobra_end: Option<String>,
    /// The completion date.
    #[serde(rename = "completion", skip_serializing_if = "Option::is_none")]
    pub completion: Option<String>,
    /// The coordination of benefits date.
    #[serde(
        rename = "coordinationOfBenefits",
        skip_serializing_if = "Option::is_none"
    )]
    pub coordination_of_benefits: Option<String>,
    /// The date of death. Payers may return this information in the case of a deceased subscriber or dependent.
    #[serde(rename = "dateOfDeath", skip_serializing_if = "Option::is_none")]
    pub date_of_death: Option<String>,
    /// The date when the plan information was last updated.
    #[serde(rename = "dateOfLastUpdate", skip_serializing_if = "Option::is_none")]
    pub date_of_last_update: Option<String>,
    /// The discharge date.
    #[serde(rename = "discharge", skip_serializing_if = "Option::is_none")]
    pub discharge: Option<String>,
    /// The effective date of change.
    #[serde(
        rename = "effectiveDateOfChange",
        skip_serializing_if = "Option::is_none"
    )]
    pub effective_date_of_change: Option<String>,
    /// Plan eligibility dates.
    #[serde(rename = "eligibility", skip_serializing_if = "Option::is_none")]
    pub eligibility: Option<String>,
    /// The date when the patient is first eligible for benefits under the plan.
    #[serde(rename = "eligibilityBegin", skip_serializing_if = "Option::is_none")]
    pub eligibility_begin: Option<String>,
    /// The date when the patient is no longer eligible for benefits under the plan.
    #[serde(rename = "eligibilityEnd", skip_serializing_if = "Option::is_none")]
    pub eligibility_end: Option<String>,
    /// The date when the patient is enrolled in the plan.
    #[serde(rename = "enrollment", skip_serializing_if = "Option::is_none")]
    pub enrollment: Option<String>,
    /// The issue date.
    #[serde(rename = "issue", skip_serializing_if = "Option::is_none")]
    pub issue: Option<String>,
    /// The latest visit or consultation date.
    #[serde(
        rename = "latestVisitOrConsultation",
        skip_serializing_if = "Option::is_none"
    )]
    pub latest_visit_or_consultation: Option<String>,
    /// The end of a period.
    #[serde(rename = "periodEnd", skip_serializing_if = "Option::is_none")]
    pub period_end: Option<String>,
    /// The start of a period.
    #[serde(rename = "periodStart", skip_serializing_if = "Option::is_none")]
    pub period_start: Option<String>,
    /// Plan effective dates.
    #[serde(rename = "plan", skip_serializing_if = "Option::is_none")]
    pub plan: Option<String>,
    /// The date coverage from the plan begins.
    #[serde(rename = "planBegin", skip_serializing_if = "Option::is_none")]
    pub plan_begin: Option<String>,
    /// The date coverage from the plan ends.
    #[serde(rename = "planEnd", skip_serializing_if = "Option::is_none")]
    pub plan_end: Option<String>,
    /// The date when the policy becomes effective.
    #[serde(rename = "policyEffective", skip_serializing_if = "Option::is_none")]
    pub policy_effective: Option<String>,
    /// The date when the policy expires.
    #[serde(rename = "policyExpiration", skip_serializing_if = "Option::is_none")]
    pub policy_expiration: Option<String>,
    /// The start of the period when the plan premium was paid in full.
    #[serde(
        rename = "premiumPaidToDateBegin",
        skip_serializing_if = "Option::is_none"
    )]
    pub premium_paid_to_date_begin: Option<String>,
    /// The end of period when the plan premium payments are up-to-date.
    #[serde(
        rename = "premiumPaidToDateEnd",
        skip_serializing_if = "Option::is_none"
    )]
    pub premium_paid_to_date_end: Option<String>,
    /// The primary care provider date.
    #[serde(
        rename = "primaryCareProvider",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_care_provider: Option<String>,
    /// The service date or dates.
    #[serde(rename = "service", skip_serializing_if = "Option::is_none")]
    pub service: Option<String>,
    /// The status date.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
}

impl PlanDateInformation {
    /// Contains the dates associated with the subscriber and dependents' (if applicable) insurance plan. This information is used to determine their eligibility for benefits. - Most fields contain a single date, but some can contain either a single date or a date range. Each field's documentation specifies its format. - Fields that can contain either a single date or date range include: `plan`, `eligibility`, `planBegin`, `admission`, and `service`. - The provided dates apply to every benefit within the patient's health plan unless specifically noted within a `benefitsInformation.benefitsDateInformation` object. - If the payer sends back date(s) that are different for the subscriber and dependents, Stedi includes only the dates for the dependent in this object and omits the subscriber's date(s). Dependents can have different coverage dates than the subscriber due to qualifying life events, such as starting a new job or passing the age limit for coverage through their parent's plan. - Most payers return either `plan` or `planBegin` and `planEnd`, but the exact dates returned depend on the payer's discretion and the patient's insurance plan. - If the date of service is after the earliest ending `plan`, `eligibility`, `planEnd`, `eligibilityEnd`, `policyEffective`, or `policyExpiration` value, the patient likely doesn't have active coverage.
    pub fn new() -> PlanDateInformation {
        PlanDateInformation {
            added: None,
            admission: None,
            benefit: None,
            benefit_begin: None,
            benefit_end: None,
            certification: None,
            cobra_begin: None,
            cobra_end: None,
            completion: None,
            coordination_of_benefits: None,
            date_of_death: None,
            date_of_last_update: None,
            discharge: None,
            effective_date_of_change: None,
            eligibility: None,
            eligibility_begin: None,
            eligibility_end: None,
            enrollment: None,
            issue: None,
            latest_visit_or_consultation: None,
            period_end: None,
            period_start: None,
            plan: None,
            plan_begin: None,
            plan_end: None,
            policy_effective: None,
            policy_expiration: None,
            premium_paid_to_date_begin: None,
            premium_paid_to_date_end: None,
            primary_care_provider: None,
            service: None,
            status: None,
        }
    }
}
