// Mirrors ROLAC.API.DTOs.Settings — site + notification settings edited from the
// Church Profile tabbed page (Settings permission module).

export interface SiteSettingDto {
  siteTitle: string;
  siteTitleZh: string | null;
  defaultLanguage: string;   // 'en' | 'zh'
  timeZone: string;
  dateFormat: string;
  currency: string;
}

export type UpdateSiteSettingRequest = SiteSettingDto;

export interface NotificationSettingDto {
  enableEmail: boolean;
  smtpHost: string;
  smtpPort: number;
  smtpUseSsl: boolean;
  smtpUser: string;
  fromAddress: string;
  fromName: string;
  /** True when a password is stored — secrets themselves are never returned. */
  hasSmtpPassword: boolean;

  enableLine: boolean;
  hasLineChannelAccessToken: boolean;
  hasLineChannelSecret: boolean;

  /** Read-only webhook URL to register in the Line console. */
  webhookUrl: string;
}

export interface UpdateNotificationSettingRequest {
  enableEmail: boolean;
  smtpHost: string;
  smtpPort: number;
  smtpUseSsl: boolean;
  smtpUser: string;
  fromAddress: string | null;
  fromName: string | null;
  /** Leave blank/omit to keep the stored password. */
  smtpPassword?: string | null;

  enableLine: boolean;
  /** Leave blank/omit to keep the stored token. */
  lineChannelAccessToken?: string | null;
  /** Leave blank/omit to keep the stored secret. */
  lineChannelSecret?: string | null;
}

export interface TestEmailRequest {
  toAddress?: string | null;
}

export interface TestLineRequest {
  memberId?: number | null;
  groupId?: number | null;
}

/** Mirrors ROLAC.API NotificationResult. */
export interface NotificationResult {
  sentCount: number;
  failedCount: number;
  failures: { target: string; error: string }[];
}
