import { z } from "zod";
import { DynaBridgeEntity } from 'dynabridge';

export const LOG_CALL_SK = "log-call";

export const LogCallSchema = z.object({
  // keys
  PK: z.string(), // OTP
  SK: z.literal(LOG_CALL_SK).default(LOG_CALL_SK),
  caller: z.string(),
  TTL: z.number(),
});

export const getLogCallID = (otp: string): string[] => {
  return [otp, LOG_CALL_SK];
}

export type LogCall = z.infer<typeof LogCallSchema>;

export const LogCallEntity: DynaBridgeEntity<LogCall> = {
  tableName: "doorman",
  id: ["PK", "SK"],
};
