import {FilterStatusType} from "../ReactComponents";
import {Order} from "../../components/UI/DuaList/ListHeader/ListHead";
import {Dayjs} from 'dayjs';
import { GetRequestParams } from "../Axios";

export interface PersonnelRequestsParams {
    order: Order,
    order_by: string,
    list_type: string
    page_size: number
    page: number
    search: string
    contract_types: string[]
}

export interface PersonnelItem {
    active_card_requests: PersonnelCardRequest
    active_account_requests: PersonnelCardRequest
    request_counters: RequestCount
    temporary_card_date: Dayjs | string | null
    can_renew_contract: any;
    can_terminate_contract: boolean
    has_recently_resolved_card_renew_request: boolean
    unit_acronym: string
    id: number
    fullname: string
    contract_type?: PersonnelContractType
    father_name: string
    gender: string
    mobile_phone: string
    contract_status: string
    active_requests: string
    contract: string
    scientific_supervisor: string
    contract_end_date: any
    is_dua: boolean
    contract_data: null | {
        contract_code: number
        project_code: number
        lastname: string
        firsname: string
        unit_code: 1098700,
        unit_acronym: string
        contract_type: string
        contract_duration: 6,
        contract_cost: 13438.37,
        education_category: string
        contract_start_date: string
        contract_end_date: string
        personal_email: string
        gender: 'Male' | 'Female' | 'male' | 'female'
        birth_date: string
        amka: string
        afm: string
        fathers_name: string
        user_code: number
        scientific_supervisor_code: number
        scientific_supervisor_fullname: string
    }
}

export interface TerminateCollaborationParams {
    user_id: number
    // contract_start_date: string
    // contract_end_date: string
}

// export interface PersonnelContractType {
//     id: number
//     name: 'ΕΡΓΟΥ' | 'ΕΡΓΑΣΙΑΣ' | 'ΤΙΤΛΟΣ ΚΤΙΣΗΣ'
//     view_name: string
//     view_name_el: string
//     view_name_plural?: string
//     type: FilterStatusType
// }

export interface PersonnelContractType {
    id: number
    name: 'ergou' | 'ergasias' | 'title_of_ownership' | 'university'
    view_name_el: string
    description: string
    ui_type: FilterStatusType
}

interface PersonnelCardRequest {
    name: string
    type: any
    type_id: number
}

interface PersonnelAccountRequest {
    type: any
    type_id: number
}

interface RequestCount {
    total_count: number
    active_count:number
}

export interface Employee {
    employee_id: any,
    type:string,
    work_relation: string,
    firstname: string,
    fathers_name: string,
    lastname: string,
    unit: string,
    staff_category: string,
    mobile_phone: string,
    phone: string,
    email:string,
    onboarding_date:string,
    offboarding_date:string,
    boarding_status:string,
    comments?: any,
    hr_notes?: any
}

export interface GetEmployeesParams extends GetRequestParams {
    active_role: any,
    unit_id: any,
    list_type: any,
    gender:any,
    sector: any,
    research_group: any,
    work_relation:any,
    staff_category:any,
    boarding_status:any,
    is_active_dua: any,
    order: Order,
    order_by: string
    search: string,
}

interface IdValuePair {
  id: string | number;
  value: string;
}

interface ValueNamePair {
  value: string | number;
  name: string;
}

interface Lookups {
  units: IdValuePair[];
  genders: IdValuePair[];
  staff_categories: IdValuePair[];
  boarding_statuses: IdValuePair[];
  work_relations: ValueNamePair[];
}

interface Metadata {
  page_count: number;
  page: string;
  page_size: string;
  total_count: number;
}

interface UsersData {
  metadata: Metadata;
  records: Employee[];
}

export interface GetEmpoyeeList {
  lookups: Lookups;
  users: UsersData;
}
