/**
 * Freebit SIM Provider - Raw Types
 */

import { z } from "zod";

// Freebit Account Details Response (raw from API)
export const freebitAccountDetailsRawSchema = z.object({
  resultCode: z.string().optional(),
  resultMessage: z.string().optional(),
  responseDatas: z.array(
    z.object({
      kind: z.string().optional(),
      account: z.union([z.string(), z.number(), z.null()]).optional(),
      state: z.string().optional(),
      status: z.string().optional(),
      planCode: z.union([z.string(), z.number(), z.null()]).optional(),
      planName: z.union([z.string(), z.null()]).optional(),
      simSize: z.string().optional(),
      iccid: z.string().optional(),
      eid: z.union([z.string(), z.number(), z.null()]).optional(),
      msisdn: z.string().optional(),
      imsi: z.string().optional(),
      quota: z.union([z.string(), z.number()]).optional(),
      quotaKb: z.union([z.string(), z.number()]).optional(),
      voicemail: z.string().optional(),
      voiceMail: z.string().optional(),
      callwaiting: z.string().optional(),
      callWaiting: z.string().optional(),
      worldwing: z.string().optional(),
      worldWing: z.string().optional(),
      contractLine: z.string().optional(),
      startDate: z.string().optional(),
      expireDate: z.string().optional(),
    })
  ),
});

export type FreebitAccountDetailsRaw = z.infer<typeof freebitAccountDetailsRawSchema>;

// Freebit Traffic Info Response
export const freebitTrafficInfoRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
  account: z.union([z.string(), z.number()]).optional(),
  traffic: z.object({
    today: z.union([z.string(), z.number()]).optional(),
    inRecentDays: z.union([z.string(), z.number()]).optional(),
    blackList: z.union([z.string(), z.number()]).optional(),
  }).optional(),
});
export const freebitTopUpRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
});

export type FreebitTopUpRaw = z.infer<typeof freebitTopUpRawSchema>;

export const freebitAddSpecRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
});

export type FreebitAddSpecRaw = z.infer<typeof freebitAddSpecRawSchema>;

export const freebitPlanChangeRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
  ipv4: z.string().optional(),
  ipv6: z.string().optional(),
});

export type FreebitPlanChangeRaw = z.infer<typeof freebitPlanChangeRawSchema>;

export const freebitCancelPlanRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
});

export type FreebitCancelPlanRaw = z.infer<typeof freebitCancelPlanRawSchema>;

export const freebitCancelAccountRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
});

export type FreebitCancelAccountRaw = z.infer<typeof freebitCancelAccountRawSchema>;

export const freebitEsimReissueRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
});

export type FreebitEsimReissueRaw = z.infer<typeof freebitEsimReissueRawSchema>;

export const freebitEsimAddAccountRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
});

export type FreebitEsimAddAccountRaw = z.infer<typeof freebitEsimAddAccountRawSchema>;

export type FreebitTrafficInfoRaw = z.infer<typeof freebitTrafficInfoRawSchema>;

// Freebit Quota History Response
export const freebitQuotaHistoryRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
  account: z.union([z.string(), z.number()]).optional(),
  total: z.union([z.string(), z.number()]).optional(),
  count: z.union([z.string(), z.number()]).optional(),
  quotaHistory: z.array(
    z.object({
      addQuotaKb: z.union([z.string(), z.number()]).optional(),
      addDate: z.string().optional(),
      expireDate: z.string().optional(),
      campaignCode: z.string().optional(),
    })
  ).optional(),
});

export type FreebitQuotaHistoryRaw = z.infer<typeof freebitQuotaHistoryRawSchema>;

export const freebitAuthResponseRawSchema = z.object({
  resultCode: z.string().optional(),
  status: z
    .object({
      message: z.string().optional(),
      statusCode: z.union([z.string(), z.number()]).optional(),
    })
    .optional(),
  authKey: z.string().optional(),
});

export type FreebitAuthResponseRaw = z.infer<typeof freebitAuthResponseRawSchema>;

