The following are all IDTypes…
[
{
"id": "DNI",
"name": "DNI",
"type": "number",
"min_length": 7,
"max_length": 8
},
{
"id": "CI",
"name": "Cdula",
"type": "number",
"min_length": 1,
"max_length": 9
},
{
"id": "LC",
"name": "L.C.",
"type": "number",
"min_length": 6,
"max_length": 7
},
{
"id": "LE",
"name": "L.E.",
"type": "number",
"min_length": 6,
"max_length": 7
},
{
"id": "Otro",
"name": "Otro",
"type": "number",
"min_length": 5,
"max_length": 20
}
]
Can I create this list (array) of objects IdTypes in the IDE (sort of enum) ?
How do you guys deal with it ?
What I would like is when I call the constructor of a new ID I just pass Idtype as an argument, and then the ID data is validated (min/max length and ‘isnumeric’) and also ‘name’ property is automatically set.
I should do this with a select case in the constructor of the ID class or there is a smarter way to do it ?
Thanks for the input.
R