interface ResponseTitle {
  fullname: string;
  organizationPositionOld: string;
  positionLevelOld: string;
  positionTypeOld: string;
}

interface ResponseRow {
  id: string;
  citizenId: string;
  fullname: string;
  organizationName: string;
  orgName: string;
  organizationShortName: string;
  positionNumber: string;
  positionPath: string;
  birthday: string | null;
  status: string;
  statusText: string;
  createdAt: Date | null;
  dateText: string | null;
  educationOld: string;
  organizationPositionOld: string;
  positionTypeOld: string;
  positionLevelOld: string;
  positionNumberOld: string;
  positionId: string;
  positionTypeId: string;
  positionLevelId: string;
  amountOld: number;
  posTypeOldId: string;
  posLevelOldId: string;
  positionOld: string;
  posMasterNo: number;
}

interface ResponseData {
  citizenId: string;
  createdAt: Date;
  dateOfBirth: Date;
  educationOld: string;
  firstname: string;
  gender: string;
  id: string;
  isActive: boolean;
  lastname: string;
  organizationName: string;
  organizationPositionId: string;
  organizationPositionOld: string;
  organizationShortName: string;
  posNoId: string;
  positionId: string;
  positionLevel: string;
  positionLevelId: string;
  positionLevelOld: string;
  positionLine: string;
  positionLineId: string;
  positionNumber: string;
  positionNumberOld: string;
  positionPath: string;
  positionPathSide: string;
  positionPathSideId: string;
  positionType: string;
  positionTypeId: string;
  positionTypeOld: string;
  prefix: string;
  reason: string;
  recruitDate: Date;
  salary: number;
  status: string;
  amountOld: number;
}

interface DataActive {
  activeId: string;
  activeName: string;
  draftId: string;
  draftName: string;
  isPublic: boolean;
  orgPublishDate: Date | null;
}

interface OrgTree {
  orgTreeId: string;
  orgRootId: string;
  orgLevel: number;
  orgTreeName: string;
  orgTreeShortName: string;
  orgTreeCode: string;
  orgCode: string;
  orgTreeRank: string;
  orgTreeOrder: number | null;
  orgRootCode: string;
  orgTreePhoneEx: string;
  orgTreePhoneIn: string;
  orgTreeFax: string;
  orgRevisionId: string;
  children: OrgTree[];
}

interface DataTree {
  orgTreeId: string;
  orgRootId?: string;
  orgLevel: number;
  orgName: string;
  orgTreeName: string;
  orgTreeShortName: string;
  orgTreeCode: string;
  orgCode: string;
  orgTreeRank: string;
  orgTreeOrder: number;
  orgRootCode?: string;
  orgTreePhoneEx: string;
  orgTreePhoneIn: string;
  orgTreeFax: string;
  orgRevisionId: string;
  orgRootName: string;
  totalPosition: number;
  totalPositionCurrentUse: number;
  totalPositionCurrentVacant: number;
  totalPositionNextUse: number;
  totalPositionNextVacant: number;
  totalRootPosition: number;
  totalRootPositionCurrentUse: number;
  totalRootPositionCurrentVacant: number;
  totalRootPositionNextUse: number;
  totalRootPositionNextVacant: number;

  children?: DataTree[];
}
interface SumPosition {
  totalPosition: number;
  totalPositionCurrentUse: number;
  totalPositionCurrentVacant: number;
  totalPositionNextUse: number;
  totalPositionNextVacant: number;
  totalRootPosition: number;
  totalRootPositionCurrentUse: number;
  totalRootPositionCurrentVacant: number;
  totalRootPositionNextUse: number;
  totalRootPositionNextVacant: number;
}

interface PositionMaim {
  fullNameCurrentHolder: string | null;
  fullNameNextHolder: string | null;
  id: string;
  isPosition: boolean;
  isSit: boolean;
  orgRootId: string;
  orgShortname: string;
  posMasterNo: number;
  posMasterNoPrefix: string;
  posMasterNoSuffix: string;
  posExecutiveId: string;
  posExecutiveName: string;
  posLevelId: string;
  posLevelName: string;
  posTypeId: string;
  posTypeName: string;
  positionArea: string;
  positionExecutiveField: string;
  positionField: string;
  positionIsSelected: boolean;
  positionName: string;
  positions: Positions[];
  node: number;
  nodeId: string;
}

interface PositionNo {
  fullNameCurrentHolder: string | null;
  fullNameNextHolder: string | null;
  id: string;
  isPosition: boolean;
  isSit: boolean;
  orgRootId: string;
  orgShortname: string;
  posMasterNo: number;
  posMasterNoPrefix: string;
  posMasterNoSuffix: string;
  positions: Positions[];
}

interface Positions {
  id: string;
  posExecutiveId: string;
  posExecutiveName: string;
  posLevelId: string;
  posLevelName: string;
  posTypeId: string;
  posTypeName: string;
  positionArea: string;
  positionExecutiveField: string;
  positionField: string;
  positionIsSelected: boolean;
  positionName: string;
}

interface DataPositionNo {
  id: string;
  isPosition: boolean;
  posMasterNo: string;
  positionName: string;
  posTypeName: string;
  posLevelName: string;
  positionIsSelected: string | null;
  isSit: boolean;
  positions: Positions[];
}

interface TreeMain {
  children: TreeMain[]; // ปรับเป็นชนิดข้อมูลที่ถูกต้องตามโครงสร้างของ children ถ้าเป็นไปได้
  orgCode: string;
  orgLevel: number;
  orgName: string;
  orgRevisionId: string;
  orgRootName: string;
  orgTreeCode: string;
  orgTreeFax: string;
  orgTreeId: string;
  orgTreeName: string;
  orgTreeOrder: number;
  orgTreePhoneEx: string;
  orgTreePhoneIn: string;
  orgTreeRank: string;
  orgTreeShortName: string;
  totalPosition: number;
  totalPositionCurrentUse: number;
  totalPositionCurrentVacant: number;
  totalPositionNextUse: number;
  totalPositionNextVacant: number;
  totalRootPosition: number;
  totalRootPositionCurrentUse: number;
  totalRootPositionCurrentVacant: number;
  totalRootPositionNextUse: number;
  totalRootPositionNextVacant: number;
}

interface DataProfile {
  child1: string | null;
  child1ShortName: string | null;
  child2: string | null;
  child2ShortName: string | null;
  child3: string | null;
  child3ShortName: string | null;
  child4: string | null;
  child4ShortName: string | null;
  createdAt: string | Date;
  dateEnd: string | Date;
  dateStart: string | Date;
  firstName: string;
  id: string;
  isActive: boolean;
  lastName: string;
  organization: string;
  organizationPositionOld: string;
  posLevelName: string;
  posMasterNo: number | null;
  posTypeName: string;
  position: string;
  prefix: string;
  profileId: string;
  reason: string;
  root: string;
  rootShortName: string | null;
  status: string;
  rank?: string | null;
}

export type {
  ResponseTitle,
  ResponseData,
  ResponseRow,
  DataActive,
  OrgTree,
  DataTree,
  SumPosition,
  PositionMaim,
  PositionNo,
  Positions,
  DataPositionNo,
  TreeMain,
  DataProfile,
};
