import { 
  DefaulResponsePagination,
  DefaultRequestPagination,
  ErrorResponse,
} from '@/entities/common/model/types';

export interface LoginParams {
  id: string;
  password: string;
};

export interface MenuGrantsItem {
  menuId: number;
  grant: number;
};
export interface LoginResponse {
  usrid?: string;
  tokenType?: string;
  accessToken?: string;
  refreshToken?: string;
  accessTokenExpiresIn?: number;
  refreshTokenExpiresIn?: number;
  menuGrants?: Array<MenuGrantsItem>;
  clientAddressIP?: string;
  tempToken?: string,
  tempTokenExpiresIn?: number;
  available2FAMethod?: Array<string>;
  requires2FA?: boolean;
  deviceId?: string;
  appVersion: string;
};

export interface UserFavorite {
  seq?: number;
  menuId?: number;
  menuName?: string;
  menuNameEng?: string;
  iconFilePath?: string | null;
  programPath?: string;
};
export interface UserInfo extends LoginResponse {
  status: boolean;
  error?: ErrorResponse;
}
export interface UserParams {
  status: boolean;
  error?: ErrorResponse;
};

export interface UserListItem {
  usrid: string;
  idCL: string;
  status: string;
}

export interface UserFindResponse extends DefaulResponsePagination {
  content: Array<UserListItem>;
};

export interface UserFindParams {
  mid: string;
  page: DefaultRequestPagination;
};

export interface UserExistsUseridParams {
  usrId: string;
};

export interface UserFindAuthMethodParams {
  mid: string;
  usrid: string;
  idCL?: string;
  status?: string;
  page?: DefaultRequestPagination;
};

export interface UserFindAuthMethodResponse {
  status: boolean;
  data: UserAuthMethodData;
};

export interface UserExistsUseridResponse {
  exists: boolean;
};

export interface AuthMethodModifyItem {
  usrid: string;
  systemAdminClassId: string;
  idCl: string;
  authMethodType: string;
  sequence: number;
  content: string;
}

export interface UserModifyAuthMethodParams {
  addMethods?: Array<AuthMethodModifyItem>;
  removeMethods?: Array<AuthMethodModifyItem>;
};

export interface UserModifyAuthMethodResponse {
  status: boolean;
  error?: ErrorResponse;
};

export interface UserUpdatePermissionsParams {
  mid: string;
  usrid: string;
  idCl: string;
  status: string;
}

export interface UserUpdatePermissionsResponse {
  status: boolean;
  error?: ErrorResponse;
}

export interface UserMenuPermissionsParams {
  mid: string;
  usrid: string;
}

export interface UserMenuPermissionsResponse {
  permissions: Array<UserMenuPermissionData>;
}

export interface UserMenuPermissionsSaveParams {
  mid: string;
  namsUserMenuAccess: Array<UserMenuPermissionData>;
}

export interface UserMenuPermissionsSaveResponse {
  status: boolean;
  error?: ErrorResponse;
}


export interface UserMenuPermissionData {
  menuId: number;
  usrid: string;
  grant: number;
  defaultGrant: number;
}

export interface ChangePasswordParams {
  usrid: string;
  currentPassword: string;
  newPassword: string;
}

export interface ChangePasswordResponse {
  status: boolean;
  error?: ErrorResponse;
}

export interface ChangeCancelPasswordParams {
  mid: string;
  password: string;
}

export interface ChangeCancelPasswordResponse {
  status: boolean;
  error?: ErrorResponse;
}

export interface VerificationsItem {
  type: string;
  contact: string;
};

export interface UserCreateParams {
  mid: string;
  usrid: string;
  password: string;
  loginRange: string;
  verifications: Array<VerificationsItem>
};

export interface UserData {
  usrid: string;
  mid: string;
  gid: string;
  aid: string;
  pw: string;
  authCd: string;
  status: string;
  regDt: string;
  memo: string;
  changeDt: string;
  failCnt: number;
  oldPw1: string;
  oldPw2: string;
  oldPw3: string;
  oldPw4: string;
  worker: string;
  loginCd: string;
  pwWorkIp: string;
  pwCheckYn: string;
  loginFailDt: string;
  loginFailTm: string;
  loginFailIp: string;
  desaYn: string;
  desaAccType: string;
  desaAccIp: string;
  desaProcType: string;
  desaFormat: string;
  desaSvcCl: string;
  emailAuth1: string;
  emailAuth2: string;
  emailAuth3: string;
  authDt: string;
  authTm: string;
  userAidGroupYn: string;
  userAidGroupId: string;
  subNm: string;
  subLevel: string;
  multiAccessYn: string;
};
export interface UserCreateResponse {
  user: UserData;
};

export interface AuthMethodItem {
  usrid: string;
  systemAdminClassId: string;
  authMethodType: string;
  sequence: number;
  content: string;
};

export interface UserAuthMethodData {
  emails: Array<AuthMethodItem>;
  phones: Array<AuthMethodItem>;
};

export interface ShortcutDefaultParams {
  usrid: string;
};
export interface ShortcutDefaultResponse {
  shortcuts: Array<Shortcuts>;
  usingDefault: boolean;
};
export interface Shortcuts {
  seq: number;
  menuId: number;
  menuName: string;
  menuNameEng: string;
  iconFilePath: string;
  programPath: string;
};
export interface ShortcutSaveParams {
  usrid: string;
  isDefault: boolean;
  menuIds: Array<number | undefined>;
};
export interface ShortcutSaveResponse {

};
export interface ShortcutUserParams {
  usrid: string;
};
export interface ShortcutUserResponse {
  shortcuts: Array<Shortcuts>;
  usingDefault: boolean;
};

export interface BusinessPropertyParams {
  mid: string;
};
export interface BusinessPropertyResponse {
  companyNumber: string;
  businessScaleTypeName: string;
};
export interface BusinessInfo extends BusinessPropertyResponse {

};