import {z} from 'zod'

// what a report can point at: a person or a piece of their content. account
// covers the profile; crumb/trail cover shared content
export const ReportSubjectTypeSchema = z.enum([
  'user',
  'crumb',
  'trail',
])

// a small, legible reason set (cf. bsky's granular taxonomy, pared to what a
// friends app needs); free-text detail carries the specifics
export const ReportReasonSchema = z.enum([
  'spam',
  'harassment',
  'inappropriate',
  'other',
])

export const REPORT_DETAIL_MAX = 1000

export const BlockUserSchema = z.object({userId: z.uuid()})

export const ReportSchema = z.object({
  subjectType: ReportSubjectTypeSchema,
  subjectId: z.uuid(),
  reason: ReportReasonSchema,
  detail: z.string().trim().max(REPORT_DETAIL_MAX).optional(),
})

export type ReportSubjectType = z.infer<
  typeof ReportSubjectTypeSchema
>
export type ReportReason = z.infer<typeof ReportReasonSchema>
export type ReportInput = z.infer<typeof ReportSchema>
