import type { IBaseResponse } from "@/types/response.types";

export interface Pager {
  page: number;
  limit: number;
  totalItems: number;
  totalPages: number;
  prevPage: boolean;
  nextPage: string | null;
}

export interface ITicketCategory {
  _id: string;
  title_fa: string;
  description: string;
  createdAt: string;
  updatedAt: string;
}

export interface ITicketCategoriesResponse extends IBaseResponse {
  results: {
    categories: ITicketCategory[];
  };
}

export type CreateTicketCategoryType = {
  title_fa: string;
  description: string;
};

export type CreateTicketMessageType = {
  content: string;
  attachments: string[];
};

export interface ISeller {
  _id: string;
  fullName: string;
  phoneNumber: string;
  email: string;
}

export type TicketStatus = "closed" | "answered" | "pending";

export interface ITicket {
  _id: string;
  numericId: number;
  seller: ISeller;
  category: ITicketCategory;
  subject: string;
  status: TicketStatus;
  updatedAt: string;
}

export interface ITicketsResponse extends IBaseResponse {
  results: {
    tickets: ITicket[];
    pager: Pager;
  };
}

export interface IMessage {
  _id?: string;
  content: string;
  attachments?: string[];
  createdAt?: string;
  updatedAt?: string;
  senderRef?: string;
}

export interface ITicketResponse extends IBaseResponse {
  results: {
    ticket: ITicket;
    messages: IMessage[];
  };
}
