-- Active: 1782426846920@@thomas.proxy.rlwy.net@19878@railway
-- Example seed for one Mollie billing provider connection.
-- Replace placeholder values before running this in a real environment.

INSERT INTO billing.billing_provider_connections (
    owner_kind,
    owner_id,
    provider,
    mode,
    status,
    credential_kind,
    provider_account_id,
    provider_profile_id,
    scopes,
    config,
    metadata
)
VALUES (
    'org',
    'replace-me-org-id',
    'mollie',
    'test',
    'active',
    'advanced_access_token',
    'replace-me-mollie-organization-id',
    'pfl_replace_me',
    '[
      "payments.read",
      "payments.write",
      "customers.read",
      "customers.write",
      "subscriptions.read",
      "subscriptions.write",
      "profiles.write"
    ]'::jsonb,
    jsonb_build_object(
        'apiBaseUrl', 'https://api.mollie.com',
        'credentialKind', 'advanced_access_token',
        'apiKey', 'replace-me-mollie-access-token',
        'mode', 'test',
        'profileId', 'pfl_replace_me',
        'signingSecrets', jsonb_build_array('replace-me-mollie-webhook-secret')
    ),
    jsonb_build_object(
        'origin', 'sql.seed',
        'notes', 'Advanced access token example. Replace placeholder values before use.'
    )
)
ON CONFLICT (owner_kind, owner_id, provider, mode)
WHERE deleted_at IS NULL
DO UPDATE SET
    status = EXCLUDED.status,
    credential_kind = EXCLUDED.credential_kind,
    provider_account_id = EXCLUDED.provider_account_id,
    provider_profile_id = EXCLUDED.provider_profile_id,
    scopes = EXCLUDED.scopes,
    config = EXCLUDED.config,
    metadata = EXCLUDED.metadata,
    updated_at = now();
