# Task Team Connector — Configuration Settings
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
    _inherit = 'res.config.settings'

    task_team_api_url = fields.Char(
        string='Task Team API URL',
        config_parameter='task_team_connector.api_url',
        default='https://api.hasdo.info/api/v1',
        help='Base URL of the Task Team REST API (no trailing slash)',
    )
    task_team_api_key = fields.Char(
        string='API Service Account Email',
        config_parameter='task_team_connector.api_key',
        help='E-mail of the Task Team service account used for API authentication',
    )
    task_team_webhook_secret = fields.Char(
        string='Webhook HMAC Secret',
        config_parameter='task_team_connector.webhook_secret',
        help='Shared secret used to verify incoming webhooks (HMAC-SHA256)',
    )
    task_team_sync_enabled = fields.Boolean(
        string='Enable Automatic Sync',
        config_parameter='task_team_connector.sync_enabled',
        default=True,
    )
    task_team_sync_interval = fields.Integer(
        string='Sync Interval (minutes)',
        config_parameter='task_team_connector.sync_interval',
        default=5,
    )
    task_team_oauth_client_id = fields.Char(
        string='OAuth Client ID',
        config_parameter='task_team_connector.oauth_client_id',
        help='Client ID registered in Task Team for the OAuth2 bridge',
    )
    task_team_oauth_client_secret = fields.Char(
        string='OAuth Client Secret',
        config_parameter='task_team_connector.oauth_client_secret',
    )
    task_team_default_project_id = fields.Many2one(
        'project.project',
        string='Default Project for Incoming Tasks',
        config_parameter='task_team_connector.default_project_id',
        help='Project assigned to tasks created via inbound webhook',
    )
