import { z } from 'zod';

export const VCSchema = z.object({
  id: z.string().uuid(),
  type: z.array(z.string()),
  issuer: z.string(),
  subject: z.string(),
  credentialSubject: z.record(z.unknown()),
  issuanceDate: z.string().datetime(),
  expirationDate: z.string().datetime().optional(),
  proof: z
    .object({
      type: z.string(),
      created: z.string().datetime(),
      proofPurpose: z.string(),
      verificationMethod: z.string(),
      jws: z.string(),
    })
    .optional(),
});

export type VC = z.infer<typeof VCSchema>;

export const IssueVCSchema = z.object({
  subject: z.string(),
  credentialSubject: z.record(z.unknown()),
  expirationDate: z.string().datetime().optional(),
});

export type IssueVC = z.infer<typeof IssueVCSchema>;

export const VerifyVCSchema = z.object({
  credential: VCSchema,
});

export type VerifyVC = z.infer<typeof VerifyVCSchema>;

