-
Notifications
You must be signed in to change notification settings - Fork 66
/
index.d.ts
124 lines (102 loc) · 2.88 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import { Rule, RuleNode, Evaluation } from 'publicodes'
// This file is generated on package build
import { DottedName } from './dottedNames'
export { DottedName } from './dottedNames'
export type NGCRuleNode = RuleNode & {
rawNode: NGCRule
}
export type NGCRulesNodes = Record<DottedName, NGCRuleNode>
type Color = `#${string}`
export type NodeValue = Evaluation
export type SuggestionsNode = Record<
string,
string | number | Record<string, string | number>
>
export type MosaiqueNode = {
type: 'selection' | 'nombre'
options: DottedName[]
total?: number
suggestions?: SuggestionsNode
}
export type MosaicInfos = {
mosaicRule: RuleNode
mosaicParams: MosaiqueNode
mosaicDottedNames: [DottedName, NGCRuleNode][]
}
type Formule = any
export type MigrationType = {
keysToMigrate: Record<DottedName, DottedName>
valuesToMigrate: Record<DottedName, Record<string, NodeValue>>
}
export type Persona = {
nom: string
description: string
icônes: string
résumé?: string
situation: Partial<Record<DottedName, string | number>>
}
export type Personas = Record<string, Persona>
export type migrationType = {
keysToMigrate: Record<DottedName, DottedName>
valuesToMigrate: Record<DottedName, Record<string, NodeValue>>
}
export type RegionAuthor = {
nom: string
url?: string
}
export type RegionCode = string
export type RegionParams = {
code: RegionCode
nom: string
gentilé: string
authors?: RegionAuthor[]
drapeau?: string
}
export type SupportedRegionType = {
[currentLang: string]: RegionParams
}
export type SupportedRegions = { [key: string]: SupportedRegionType }
export type NGCRule = Rule & {
abréviation?: string
couleur?: Color
mosaique?: MosaiqueNode
type?: string
action?: { dépasse: string[] }
icônes?: string
sévérité?: string
dottedName?: DottedName
question?: string
plus?: boolean
formule?: Formule
aide?: string
inactif?: string
résumé?: string
plancher?: number
avertissement?: string
}
// TODO : should be defined from "métrique" rule directly
export type Metrics = 'carbone' | 'eau'
// TODO: Should remove "| string" when frontend migrates to model DottedName type
export type NGCRules = Record<DottedName | string, NGCRule>
export type FunFacts = {
percentageOfBicycleUsers: number
percentageOfVegetarians: number
percentageOfCarOwners: number
percentageOfPlaneUsers: number
percentageOfLongPlaneUsers: number
averageOfCarKilometers: number
averageOfTravelers: number
percentageOfElectricHeating: number
percentageOfGasHeating: number
percentageOfFuelHeating: number
percentageOfWoodHeating: number
averageOfElectricityConsumption: number
percentageOfCoolingSystem: number
percentageOfVegan: number
percentageOfRedMeat: number
percentageOfLocalAndSeasonal: number
percentageOfBottledWater: number
percentageOfZeroWaste: number
amountOfClothing: number
percentageOfStreaming: number
}