import {
    CourseClassPlan,
    EventPaymentType,
    Gender,
    LessonType,
    MarriageStatus,
    Religion,
    TransactionRelation,
    TransactionStatus,
} from './constants';

export interface Transaction {
    id: number;
    invoice: string;
    quantity: number;
    total: number;
    status: TransactionStatus;
    transactionable: Transactionable;
    payment_url: string;
    has_payment: boolean;
    payment_proof: string;
    tickets: TicketPivot[];
    created_at: string;
}

export interface Transactionable {
    id: number;
    name: string;
    image: string;
    date: string;
    link: string;
    relation: TransactionRelation;
}

export interface TransactionEvent extends Transaction {
    transactionable: EventType;
}

export interface Course {
    id: number;
    name: string;
    slug: string;
    description: string;
    image: string;
    trailer: string;
    price: number;
    is_private: boolean;
    user_name: string;
    user_avatar: string;
    sets?: Set[];
    free_lessons?: Lesson[];
    lessons: Lesson[];
    classes?: CourseClass[];
    progress?: number;
}

export interface Enrollment {
    id: number;
    slug: string;
    course: Course;
}

export interface CourseClass {
    id: number;
    name: string;
    plan: CourseClassPlan;
    price: number;
}

export interface Set {
    id: number;
    name: string;
    lessons?: Lesson[];
}

export interface Lesson {
    id: number;
    type: LessonType;
    name: string;
    content?: string;
    is_free: boolean;
    video_url?: string;
    file_url?: string;
    is_attended: boolean;
    has_attendance: boolean;
    is_completed: boolean;
    task: string;
}

export interface EventType {
    id: number;
    name: string;
    slug: string;
    image: string;
    user_avatar: string;
    user_name: string;
    description: string;
    date_start: string;
    date_end: string;
    time_start: string;
    time_end: string;
    location: string;
    place: string;
    address: string;
    payment_type: EventPaymentType;
    province_id: number;
    price: number;
    use_auth: boolean;
    use_gender: boolean;
    use_birth_date: boolean;
    use_business_name: boolean;
    use_nik: boolean;
    use_phone_number: boolean;
    use_document: boolean;
    use_business_matching: boolean;
    payment_config: EventPaymentConfig;
    transaction_proof: string;
    tickets: TicketPivot[];
    created_at: string;
}

export interface Article {
    id: number;
    title: string;
    slug: string;
    excerpt: string;
    description: string;
    image: string;
    created_at: string;
}

export interface Category {
    id: number;
    name: string;
    created_at: string;
    updated_at: string;
}

export interface FilterEvent {
    is_event_online: boolean;
    province: string;
    category: string;
    date: string;
    search: string;
}

export interface PaymentConfig {
    id: number;
    account_number: string;
    account_name: string;
    bank_name: string;
    created_at: string;
}

export interface Ticket {
    id: number;
    name: string;
    price: number;
    stock: number;
    max_purchase: number;
    quantity: number;
    amount_people: number;
    user_quota: number;
}

export interface TicketPivot extends Ticket {
    pivot: TicketPivotData[];
}

export interface TicketPivotData {
    invoice: string;
    name: string;
    business_name: string;
    phone: string;
    document: string;
    business_matching: boolean;
    attend: boolean;
}

interface EventPaymentConfig {
    id: number;
    account_number: string;
    account_name: string;
    bank_name: string;
}

export interface Slider {
    id: number;
    image: string;
}

export interface Member {
    id: number;
    nik: string;
    name: string;
    email: string;
    phone: string;
    avatar: string;
    gender: Gender;
    religion: Religion;
    birth_date: string;
    marriage_status: MarriageStatus;
    business?: Business;
    address?: Address;
    collaborations?: Collaboration[];
    collaboration_count?: number;
    email_verified_at?: string;
}

export interface Collaboration {
    id: number;
    description: string;
    from_member_id: number;
    from_member_avatar: string;
    from_member_name: string;
}

export interface Business {
    id: number;
    name: string;
    about: string;
    profile: string;
    year_founded: number;
    business_type_id: number | null;
    business_sector_id: number | null;
    business_scale_id: number | null;
    number_of_employees: number;
    business_type?: BusinessCategory;
    business_sector?: BusinessCategory;
    business_scale?: BusinessCategory;
}

export interface Address {
    id: number;
    address: string;
    country: string;
    province_id: number;
    province?: Province;
}

export interface BusinessCategory {
    id: number;
    name: string;
    created_at: string;
    updated_at: string;
}

export interface Province {
    id: number;
    name: string;
}

export interface Option {
    value: any;
    label: string;
}

export interface MetaPagination {
    current_page: number;
    from: number;
    last_page: number;
    links: {
        url: string;
        label: string;
        active: boolean;
    }[];
    path: string;
    per_page: number;
    to: number;
    total: number;
}

export interface AboutUs {
    id: number;
    about: string;
    image_about_us: string;
    image_vision_mission: string;
    vision: string;
    mission: string;
    slider: string;
    slider_mobile: string;
}

export type PageProps<T extends Record<string, unknown> = Record<string, unknown>> = T & {
    auth: {
        user: Member;
    };
    event: EventType;
    businessTypes: Option[];
    businessScales: Option[];
    businessSectors: Option[];
    categoryArticles: Category[];
    categoryEvents: Category[];
    provinces: Option[];
    has_business_matching: boolean;
};
