import { MultiLanguageText } from './index';

export interface Announcement {
    id: number;
    title: MultiLanguageText;
    content: MultiLanguageText;
    status: string;
    is_pinned: boolean;
    published_at: Date | null;
    created_at: Date;
    updated_at: Date | null;
    attachments: AnnouncementAttachment[];
}

export interface AnnouncementAttachment {
    id: number;
    announcement_id: number;
    file_name: string;
    file_path: string;
    presigned_url?: string | null;
    created_at: Date;
    updated_at: Date;
}

export interface ListAnnouncementResponse{
    code: number;
    message: string;
    data: Announcement[];
    total: number;
    page: number;
    limit: number;
}

export interface ListAnnouncementInput{
    token: string;
    course_id: number;
    page?: number;
    limit?: number;
}

export interface CreateAnnouncementInput{
    token: string;
    course_id: number;
    title: MultiLanguageText;
    content: MultiLanguageText;
    status: string;
    is_pinned: boolean;
    published_at?: Date;
    files?: Express.Multer.File[];
}

export interface UploadAnnouncementAttachmentInput{
    token: string;
    course_id: number;
    announcement_id: number;
    file: File;
}

export interface UploadAnnouncementAttachmentResponse{
    code: number;
    message: string;
    data: AnnouncementAttachment;
}

export interface DeleteAnnouncementAttachmentInput{
    token: string;
    course_id: number;
    announcement_id: number;
    attachment_id: number;
}

export interface DeleteAnnouncementAttachmentResponse{
    code: number;
    message: string;
}

export interface CreateAnnouncementResponse{
    code: number;
    message: string;
    data: Announcement;
}

export interface UpdateAnnouncementInput{
    token: string;
    course_id: number;
    announcement_id: number;
    title: MultiLanguageText;
    content: MultiLanguageText;
    status: string;
    is_pinned: boolean;
    published_at?: Date;
    attachments?: AnnouncementAttachment[];
}

export interface UpdateAnnouncementResponse{
    code: number;
    message: string;
    data: Announcement;
}

export interface DeleteAnnouncementInput{
    token: string;
    course_id: number;
    announcement_id: number;
}

export interface DeleteAnnouncementResponse{
    code: number;
    message: string;
}

// Body types for TSOA controller
export interface CreateAnnouncementBody {
    title: MultiLanguageText;
    content: MultiLanguageText;
    status: string;
    is_pinned: boolean;
    published_at?: string;
}

export interface UpdateAnnouncementBody {
    title: MultiLanguageText;
    content: MultiLanguageText;
    status: string;
    is_pinned: boolean;
    published_at?: string;
}