ReglagesPlanification.kt 22 lignes · 766 octets
package fr.ebii.card2vcf.planning

import fr.ebii.card2vcf.data.ProjetEntity

/**
 * 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.
 */
data class ReglagesPlanification(
    val active: Boolean = false,
    val joursOuvres: Int = 7,
    val echeance: String? = null,
) {
    companion object {
        fun de(projet: ProjetEntity?): ReglagesPlanification = projet?.let {
            ReglagesPlanification(it.planification, it.joursOuvres, it.echeance)
        } ?: ReglagesPlanification()
    }
}