How to change value of option when Flag (checkbox) changed? CBI, models

Hello Dear Community!

I'd like to ask you an advice and help with my current code.

At CBI model level I have a Flag (checkbox).

And also I have two Values (two text inputs).

Value 1 (text input) appears when Flag checked and it shows the value of its (Value 1) option (it could be any string) from uci config file. The Value 2 is hidden by that time.

Value 2 appears when Flag unchecked and it shows the value of its (Value 2) option (it could be any string) from uci file. The Value 1 is hidden by that time.

I'd like to change all two Values two defaults (string "Flag checked" for Value 1 and string "Flag not checked" for Value 2) when user triggers flag. And visibility have to be the same after triggering of Flag - if Flag is checked then Value 1 appears and Value 2 is invisible, and if Flag unchecked the Value 2 appears and Value 1 is invisible.

So for example - Flag checked and Value 1 is visible and contains string "Something in Value 1' (from uci file) and the Value 2 is invisible now and contains text 'Something in Value 2' (from uci file). Then user is unchecking Flag - so the Value 2 is visible now and it should contain default string (which is 'Flag not checked') and the Value 1 is invisible now and it should containt default string too (which is 'Flag checked').

And the reverse example - Flag unchecked and Value 2 is visible and contains string "Something in Value 2' (from uci file) and the Value 1 is invisible now and contains text 'Something in Value 1' (from uci file). Then user is checking Flag - so the Value 1 is visible now and it should contain default string (which is 'Flag checked') and the Value 2 is invisible now and it should containt default string too (which is 'Flag not checked').

Is it possible to do with CBI models?

My current code:

m = Map('test_settings', translate('Test settings'), translate('Test settings'))
d = m:section(TypedSection, 'info', '')

flag_enabled = d:option(Flag, 'flag_enabled', translate('Flag enabled'))
flag_enabled.default = flag_enabled.disabled
flag_enabled.enabled = '1'
flag_enabled.disabled = '0'
flag_enabled.optional = false
flag_enabled.rmempty = false

depended_option_1 = d:option(Value, 'depended_option_1', translate('Depended option 1'))
depended_option_1:depends('flag_enabled', '1')
depended_option_1.optional = false
depended_option_1.default = 'Flag checked'
depended_option_1.rmempty = false

depended_option_2 = d:option(Value, 'depended_option_2', translate('Depended option 2'))
depended_option_2:depends('flag_enabled', '')
depended_option_2.default = 'Flag not checked'
depended_option_2.optional = false
depended_option_2.rmempty = false

return m

Thank you very much for reading my question!

Sincerely,

Alexandr