'How will you design your classes with this requisites?

Good afternoon; Let us suppose we have an object called element with properties like this:

name type description
id integer element identifier
name string element name
origin integer element origin:
0 = natural
1 = artificial
2 = mix
3 = none
4 = gov
class integer element class:
- If origin = 0 then:
0 = rainy
1 = sunny
2 = foggy
3 = cloudy
4 = none
- If origin = 1 OR origin = 4 then:
0 = nonatural
1 = disaster
subclass integer element subclass:
If origin = 0 & class = 4 then:
0 = investigate
1 = talk
2 = rest
If origin = 1 then:
0 = good
1 = bad
2 = none
If source = 4 then:
0 = countryA
1 = countryB
2 = countryC

What I want is to traduce this into classes to be able to control the "changing values" of that enums(?)(took values from xml files):

And the class could be something like:

public int id { get; set; }
       
public string name { get; set; }
       
public ElementOrigin origin { get; set; }
     
public ElementClassIfOrigin0 class { get; set; }
     
public ElementClassIfOrigin1Or4 class2 { get; set; }


public enum ElementOrigin 
    {
        
        [XmlEnum("0")] natural,
        [XmlEnum("1")] artificial,
        [XmlEnum("2")] mix,
        [XmlEnum("3")] none,
        [XmlEnum("4")] gov
    }

    
    public enum ElementClassIfOrigin0 
    {
        
        [XmlEnum("0")] rainy,
        [XmlEnum("1")] sunny,
        [XmlEnum("2")] foggy,
        [XmlEnum("3")] cloudy
    }
    
    public enum ElementClassIfOrigin1Or4 
    {
        
        [XmlEnum("0")] nonatural,
        [XmlEnum("1")] disaster
    }

What I want if to develop a logic that can handle all possible scenarios, but as the enum can change a lot, like that table; what is the best way to prepare classes for its use within this scenario(polymorphism would be helpfull?)

Because what I was trying to avoid too is something like this:

case ElementOrigin.Natural
                        when element.classIfOrigin1== ClassIfOrigin0.natural:
                        break;

case ElementOrigin.Natural
                        when element.classIfOrigin1 == ClassIfOrigin0.artificial:
                        break;

case ElementOrigin.Natural
                        when element.classIfOrigin1 == ClassIfOrigin0.none:
                        break;
//and so on..
    

Any ideas on how to proceed? Thank you so much.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source