import { z } from 'zod';

/**
 * EN: OIDC Authorization Request DTO
 * VI: DTO yêu cầu authorization OIDC
 */
export const OIDCAuthorizeDto = z.object({
  client_id: z.string().min(1),
  redirect_uri: z.string().url(),
  scope: z.string().default('openid email profile'),
  state: z.string().optional(),
  response_type: z.string().default('code'),
});

export type OIDCAuthorizeDto = z.infer<typeof OIDCAuthorizeDto>;

/**
 * EN: OIDC Token Request DTO
 * VI: DTO yêu cầu token OIDC
 */
export const OIDCTokenDto = z.object({
  grant_type: z.enum(['authorization_code', 'refresh_token']),
  code: z.string().optional(),
  refresh_token: z.string().optional(),
  client_id: z.string().min(1),
  client_secret: z.string().min(1),
  redirect_uri: z.string().url().optional(),
});

export type OIDCTokenDto = z.infer<typeof OIDCTokenDto>;
