<?php

use App\Models\Claim\Claim;
use App\Models\Client\Client;

return [

    /*
    |--------------------------------------------------------------------------
    | Contact Hub — outbound messaging configuration
    |--------------------------------------------------------------------------
    */

    'templates_backfill_solicitor_id' => env('CONTACT_TEMPLATES_BACKFILL_SOLICITOR_ID'),

    /*
    | Default dedupe window applied when a trigger does not specify its own.
    */
    'dedupe_window_minutes' => env('CONTACT_DEDUPE_WINDOW_MINUTES', 60),

    /*
    | Rate limiting — max messages per recipient/channel per window (seconds).
    */
    'rate_limit' => [
        'attempts' => env('CONTACT_RATE_LIMIT_ATTEMPTS', 5),
        'decay_seconds' => env('CONTACT_RATE_LIMIT_DECAY', 60),
    ],

    /*
    | Automatic suppression thresholds — when webhook bounces cause auto
    | opt-out additions.
    */
    'auto_suppress_on_bounce' => true,
    'auto_suppress_on_spam_report' => true,

    /*
    | Models observed for MODEL_CREATED triggers.  Each class must implement
    | a getMorphClass() compatible interface (i.e. any Eloquent model).
    */
    'trigger_observed_models' => [
        Client::class,
    ],

    /*
    | Signature defaults.  When a template does not explicitly opt out in its
    | config JSON, the sender signature is appended.
    */
    'signature' => [
        'include_by_default' => true,
        'html_separator' => '<br/><br/>',
        'text_separator' => "\n\n",
    ],

    /*
    | SMS segment calculation constants.  Used by TemplatePreview for UI hints.
    */
    'sms' => [
        'gsm7_single_segment' => 160,
        'gsm7_multi_segment' => 153,
        'ucs2_single_segment' => 70,
        'ucs2_multi_segment' => 67,
    ],

    /*
    | Webhook routing.  These values are referenced by SendContactMessageJob
    | to build statusCallback URLs for Twilio and by controllers to verify
    | that inbound requests arrive at the expected hostnames.
    */
    'webhooks' => [
        'twilio' => [
            'sms_status' => '/webhooks/contact/twilio/sms/status',
            'sms_inbound' => '/webhooks/contact/twilio/sms/inbound',
        ],
        'sendgrid' => [
            'events' => '/webhooks/contact/sendgrid',
            'inbound' => '/webhooks/contact/sendgrid/inbound',
        ],
    ],

    /*
    | Shared token appended to the SendGrid Inbound Parse webhook URL as a path
    | segment to provide basic request authentication (SendGrid Inbound Parse
    | does not sign requests like the event webhook does).
    */
    'sendgrid_inbound_token' => env('SENDGRID_INBOUND_TOKEN', ''),

    /*
    | History channel — when a message is sent we write a line against the
    | messageable model's HistoryService.  Null disables.
    */
    'history_channel' => 'contact',

];
