import { type XOR } from "../../../helpers/types";
import { type IResponse } from "../../../types/response.types";

export type LoginType = {
  phone_email: string;
};
export type LoginPasswordType = {
  password: string;
};

export type AuthStoreType = {
  phone: string;
  slug: string;
  setSlug: (value: string) => void;
  setPhone: (value: string) => void;
  email: string;
  setEmail: (value: string) => void;
  stepLogin: number;
  setStepLogin: (value: number) => void;
  otp: string;
  setOtp: (value: string) => void;
};

export type LoginWithPasswordType = XOR<
  { email: string },
  { phone: number }
> & {
  password: string;
};

export type LoginWithOtpType = {
  phone: string;
  slug: string;
};

export type OtpVerifyType = {
  phone: string;
  otp: string;
  slug: string;
};

export type CheckHasAccountType = {
  email: string;
};

export type CheckHasAccountPhoneType = {
  phone: string;
};

export type RegisterType = {
  phone: string;
  firstName: string;
  lastName: string;
  birthDate: string;
  nationalCode: string;
  password: string;
  code: number;
};
export type RefreshTokenType = {
  refreshToken: string;
};

export type AccessToken = {
  token: string;
  expire: number;
};

export type RefreshToken = {
  token: string;
  expire: number;
};

export type RefreshTokenResponseData = {
  accessToken: AccessToken;
  refreshToken: RefreshToken;
};

export type RefreshTokenResponse = IResponse<RefreshTokenResponseData>;

export type LoginWithOtpResponseData = {
  code: string;
};

export type LoginWithOtpResponse = IResponse<LoginWithOtpResponseData>;
