import { z } from 'zod';

/** TCC-style four-state authorization for CN/PH/EK frameworks. */
export const AuthStatus = z.enum(['notDetermined', 'restricted', 'denied', 'authorized', 'limited', 'writeOnly']);
export type AuthStatus = z.infer<typeof AuthStatus>;

/** Schema validated on POST /client/permissions. */
export const PermissionsPayload = z.object({
  contacts: AuthStatus,
  photos: AuthStatus,
  calendar: AuthStatus,
  reminders: AuthStatus,
  fullDisk: z.boolean(),
  mail: z.boolean(),
  notes: z.boolean(),
});
export type PermissionsPayload = z.infer<typeof PermissionsPayload>;

export interface DevicePermissionsRow {
  device_id: string;
  permissions: PermissionsPayload;
  updated_at: string;
}
