from jsonschema import Draft7Validator

from utils import *

SCHEMA_REMISE_DOMAINE = {
    TYPE: OBJECT,
    PROPERTIES: {
        "trigrammeSIP": STRING_TYPE,
        "idCorrelation": STRING_TYPE,
        "idUtilisateurRemettant": STRING_TYPE,
        "idEntiteRemettante": INTEGER_TYPE,
        "idTypeBien": STRING_TYPE,
        "idCategorie": STRING_TYPE,
        "idSousCategorie": STRING_TYPE,
        "nature": {
            TYPE: OBJECT,
            PROPERTIES: {
                "autre": BOOLEAN_TYPE,
                "scelle": BOOLEAN_TYPE,
                "ot": BOOLEAN_TYPE,
                "heberge": BOOLEAN_TYPE,
            },
            REQUIRED: ["autre", "scelle", "ot", "heberge"],
            ADDITIONAL_PROPERTIES: False
        },
        "fourriereAdministrative": BOOLEAN_TYPE,
        "description": STRING_TYPE,
        "ministere": STRING_TYPE,
        "compteBudgetaire": STRING_TYPE,
        "programme": STRING_TYPE,
        "fondsConcours": STRING_TYPE,
        "marque": STRING_TYPE,
        "modele": STRING_TYPE,
        "genre": STRING_TYPE,
        "carrosserie": STRING_TYPE,
        "numeroImmatriculation": STRING_TYPE,
        "numeroSerieVin": STRING_TYPE,
        "typeMineCnit": STRING_TYPE,
        "dateCirculation": DATE_TIME_TYPE,
        "dateCT": DATE_TIME_TYPE,
        "kilometrage": INTEGER_TYPE,
        "compteurChange": BOOLEAN_TYPE,
        "commentaireCompteur": STRING_TYPE,
        "bva": BOOLEAN_TYPE,
        "typeEnergie": STRING_TYPE,
        "nombrePlace": INTEGER_TYPE,
        "puissanceFiscale": STRING_TYPE,
        "controleTechnique": BOOLEAN_TYPE,
        "reimmatriculable": BOOLEAN_TYPE,
        "certificatImmatriculation": BOOLEAN_TYPE,
        "dateFourriere": DATE_TIME_TYPE,
        "dateAbandon": DATE_TIME_TYPE,
        "idLieuDepot": INTEGER_TYPE,
    },
    REQUIRED: [
        "trigrammeSIP",
        "idCorrelation",
        "idUtilisateurRemettant",
        "idEntiteRemettante",
        "idTypeBien",
        "idCategorie",
        "idSousCategorie",
        "nature",
        "fourriereAdministrative",
        "description",
        "ministere",
        "compteBudgetaire",
        "marque",
        "genre",
        "carrosserie",
        "numeroImmatriculation",
        "numeroSerieVin",
        "typeMineCnit",
        "dateCirculation",
        "typeEnergie",
        "nombrePlace",
        "puissanceFiscale",
        "dateFourriere",
        "dateAbandon",
        "idLieuDepot",
    ],
    ADDITIONAL_PROPERTIES: False
}

Draft7Validator.check_schema(SCHEMA_REMISE_DOMAINE)
