export interface DnsRecordSpec {
  serverId: string;
  fqdn: string;
  recordType: 'A' | 'SRV';
  target: string;
  port?: number;
  srvPriority?: number;
  srvWeight?: number;
  ttl?: number;
}

export interface DnsProvider {
  readonly name: string;
  syncRecord(record: DnsRecordSpec): Promise<void>;
  removeRecord(record: Pick<DnsRecordSpec, 'fqdn' | 'recordType'>): Promise<void>;
}

export type DnsProviderName = 'local' | 'rfc2136';

export function resolveDnsProviderName(): DnsProviderName {
  const value = (process.env['DNS_PROVIDER'] ?? 'local').toLowerCase();
  return value === 'rfc2136' ? 'rfc2136' : 'local';
}
