# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)

from odoo import api, fields, models


class ResUsers(models.Model):
    _inherit = 'res.users'

    rc_authorization_id = fields.Char(
        string='RingCentral Authorization ID',
        compute='_compute_rc_authorization_id',
        inverse='_reflect_change_in_res_users_settings',
        groups='base.group_user',
    )

    @api.depends('res_users_settings_id.rc_authorization_id')
    def _compute_rc_authorization_id(self):
        for user in self:
            user.rc_authorization_id = user.res_users_settings_id.rc_authorization_id

    @api.model
    def _get_voip_user_configuration_fields(self):
        return super()._get_voip_user_configuration_fields() + [
            'rc_authorization_id',
        ]
