import type { Channel } from './channels.js';

export interface ApplicationQuota {
  per_min: number;
  per_day: number;
}

export type ApplicationBindings = Partial<Record<Channel, string[]>>;

export interface ApplicationConfig {
  id: string;
  name: string;
  enabled: boolean;
  source: 'manual';
  channels: Channel[];
  quota: ApplicationQuota;
  bindings: ApplicationBindings;
  /** When set, dispatch is allowed only from these client IPs (exact match). */
  allowed_ips?: string[];
  created_at?: string;
  updated_at?: string;
}

export interface StoredAppKey {
  app_id: string;
  key_prefix: string; // e.g. zy_a1b2
  hash: string;       // HMAC-SHA256 digest
  created_at: number;
  expires_at?: number;
  rotated_at?: number;
}

