I have a business scenario as shown below.
I add lines of possible (key, value) pairs. (Country, climate) as one below.
Image 2 shows the entire scenario "Valid and invalid" ("Key", "Value").
Possible keys are the whole country, India, Australia, America, England
Possible values ββare all climatic, hot, dry, rainy, cold, wet
Example
if (All Country, All Climate) is selected as the first pair (England, hot) should not be selected as the second pair
If (All country, hot) is selected as the first pair (India, hot), it should not be allowed to be selected as the second pair
If (America, All Climate) is selected as the first pair (America, Hot), do not select as the second pair
where as
If (India, hot) is selected as the first pair (India, wet), then it is allowed to choose as the second pair
If (America, All Climate) is selected as the first pair (England, All Climate), then it is allowed to choose as the second pair
If (America, all climate) is selected as the first pair (India, wet), then it can be selected as the second pair
Image 1

Image 2

Question I explained "My colleague" all the permissible and unacceptable possible combinations through Image2.
In javascript, the easiest solution would be to add if else expressions and do this. At the same time, the gap between the one that I explained to solve the business scenario in the document and the code extension is widening.
What would be the best implementation of transferring a matrix in a document to code so that the business in the document and code is closely related.
This question may seem vague, but we all at least once encountered such a problem when things written to solve a problem in a document and ways to solve it using code do not make sense.