ReglagesPlanification.swift 23 lignes · 846 octets
import Foundation

/// Réglages de planification d'un projet, nécessaires pour dater ses tâches.
///
/// Le rythme conditionne le calcul de la fin (jours ouvrés) et l'échéance sert
/// de repère de retard. Par défaut la planification est éteinte : un projet qui
/// ne l'active pas n'affiche aucun repère temporel, comme sur le web.
///
/// Port de `planning/ReglagesPlanification.kt`.
struct ReglagesPlanification: Equatable {
    var active: Bool = false
    var joursOuvres: Int = 7
    var echeance: String? = nil

    static func de(_ projet: ProjetEntity?) -> ReglagesPlanification {
        guard let projet else { return ReglagesPlanification() }
        return ReglagesPlanification(
            active: projet.planification,
            joursOuvres: projet.joursOuvres,
            echeance: projet.echeance
        )
    }
}