export type LoginResponse = {
    access_token?: string;
    expires_in?: number;
    user?: User;
}

export type RegisterResponse = {
    token?: string;
    user?: User;
}

export type CreateUserResponse = {
    message?: string;
    data?: User;
}

export type ApiErrorResponse = {
    message: string;
    data: null;
    errors: Record<string, string[]>;
}

export type User = {
    id: number;
    name: string;
    email: string;
    role_id: number;
    password: string;
    created_at: string;
    updated_at: string;
    allowed_access?: boolean;
    pivot?: {
        workshop_id: number;
        user_id: number;
        created_at: string;
        updated_at: string;
    };
    videosWatched: number;
    videosCount: number;
}

export type UpdateUserResponse = {
    message?: string;
    data?: User;
}

export type GetUserResponse = {
    data?: User;
    message?: string;
}

export type CreateVideoResponse = {
    message?: string;
    data?: Video;
}

export type PaginationMeta = {
    current_page: number;
    last_page: number;
    per_page: number;
    total: number;
}

export type Video = {
    id: number;
    title: string;
    description: string;
    url: File | null;
    thumbnail: File | null;
    duration: string;
    tags: string;
    categories: Category[] | null;
    created_at: string;
    updated_at: string;
    is_active: boolean;
    order: number;
    watched: boolean;
    users: User[];
    role: number;
    nextVideo: number | null;
    previousVideo: number | null;
}

export type NextVideosResponse = {
    videos: Video[];
};

export type UpdateVideoResponse = {
    message?: string;
    data?: Video;
}

export type DashboardResponse = {
    videos: Video[];
    videosWatched: number;
    videosCount: number;
    workshops: Workshop[];
    workshopsInscribed: number;
    workshopsCount: number;
    role: number;
}

export type GetVideosResponse = {
    message?: string;
    data?: Video[];
    meta?: PaginationMeta;
}

export type CreateCategoryResponse = {
    message?: string;
    data?: Category;
}

export type Category = {
    id: number;
    name: string;
    is_active: boolean;
}

export type Workshop = {
    id: number;
    status: "pending" | "realized" | "canceled";
    title: string;
    description: string;
    image: string;
    date: string;
    time_start: string;
    time_end: string;
    is_active: boolean;
    users: User[];
    role: number;
    userId: number;
}

export type NextWorkshopsResponse = {
    workshops: Workshop[];
};

export type GetWorkshopsResponse = {
    data?: Workshop[];
    meta?: {
        current_page: number;
        last_page: number;
        total: number;
    };
}

export type getWorkshop = {
    message?: string;
    data?: Workshop;
}

export type CreateWorkshopResponse = {
    message?: string;
    data?: Workshop;
}


