// Seller Types
export interface SellerDocument {
  _id: string;
  seller: string;
  type: string;
  __v: number;
  comment: string | null;
  createdAt: string;
  docsUrl: string;
  status: "Approved" | "Pending";
  updatedAt: string;
}

export interface ShopRate {
  totalRate: number;
  totalCount: number;
  onTimeShip: number;
  returns: number;
  cancel: number;
}

export interface Shop {
  _id: string;
  shopName: string | null;
  shopDescription: string | null;
  telephoneNumber: string | null;
  shopPostalCode: string | null;
  address: string | null;
  logo: string | null;
  rate: ShopRate;
  shipmentMethod: number[];
  isChatActive: boolean;
  owner: string;
  ownerRef: string;
  createdAt: string;
  updatedAt: string;
  shopCode: number;
  __v: number;
}

export interface Contract {
  _id: string;
  content: string;
  seller: string;
  contractNumber: string;
  signed: boolean;
  singedAt: string;
  createdAt: string;
  updatedAt: string;
  __v: number;
}

export interface Seller {
  _id: string;
  fullName: string;
  dateOfBirth: string | null;
  phoneNumber: string;
  accountStatus: "Pending" | "Approved";
  isRegisterCompleted: boolean;
  businessType: string | null;
  isWholesaler: boolean;
  createdAt: string;
  updatedAt: string;
  __v: number;
  email?: string;
  documents?: SellerDocument[];
  shop: Shop;
  contracts?: Contract;
}

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

export interface SellersResponse {
  status: number;
  success: boolean;
  results: {
    sellers: Seller[];
    pager: Pager;
  };
}

export interface WholesaleRequest {
  _id: string;
  seller: {
    _id: string;
    fullName: string;
    dateOfBirth: string;
    phoneNumber: string;
    accountStatus: "Pending" | "Approved";
    isRegisterCompleted: boolean;
    businessType: string;
    isWholesaler: boolean;
    createdAt: string;
    updatedAt: string;
    email: string;
  };
  shop: Shop;
  status: "Pending" | "Approved";
  createdAt: string;
  updatedAt: string;
}

export interface WholesaleRequestsResponse {
  status: number;
  success: boolean;
  results: {
    requests: WholesaleRequest[];
    pager: {
      page: number;
      limit: number;
      totalItems: number;
      totalPages: number;
      prevPage: boolean;
      nextPage: boolean;
    };
  };
}

export interface WalletSeller {
  _id: string;
  fullName: string;
  dateOfBirth: string | null;
  phoneNumber: string;
  accountStatus: "Pending" | "Approved";
  isRegisterCompleted: boolean;
  businessType: string | null;
  isWholesaler: boolean;
  createdAt: string;
  updatedAt: string;
  email?: string;
}

export interface Wallet {
  _id: string;
  seller: WalletSeller;
  balance: number;
  createdAt: string;
  updatedAt: string;
}

export interface WithdrawalRequest {
  wallet: Wallet;
  withdrawals: unknown[]; // Empty array in example, can be expanded later
  lastPaidAmount: number | null;
  lastPaidDate: string | null;
}

export interface WithdrawalRequestsResponse {
  status: number;
  success: boolean;
  results: {
    walletData: WithdrawalRequest[];
  };
}

export interface CreateAnnouncementSeller {
  title: string;
  message: string;
  type: AnnouncementType;
}

export interface CreateAnnouncementSpecificSeller
  extends CreateAnnouncementSeller {
  sellerIds: string[];
}

export enum AnnouncementType {
  Announcement = "announcement",
  Order = "order",
  Product = "product",
  Shipment = "shipment",
  Fine = "fine",
  Wallet = "wallet",
  Ticket = "ticket",
  Chat = "chat",
  Contract = "contract",
}

export interface NotificationPager {
  page: number;
  limit: number;
  totalItems: number;
  totalPages: number;
  prevPage: boolean;
  nextPage: boolean;
}

export interface Notification {
  _id: string;
  recipient: string;
  type: string;
  title: string;
  message: string;
  meta: unknown | null;
  read: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface NotificationsResponse {
  status: number;
  success: boolean;
  results: {
    pager: NotificationPager;
    notifications: Notification[];
  };
}

export interface CreateCategoryLearning {
  title: string;
}

export interface LearningCategory {
  _id: string;
  title: string;
  deleted: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface GetLearningCategoryResponse {
  status: number;
  success: boolean;
  results: {
    learningCategory: LearningCategory[];
  };
}

// Product Request Types
export interface City {
  _id: number;
  name: string;
  province: number;
  createdAt: string;
  updatedAt: string;
}

export interface Province {
  _id: number;
  name: string;
  createdAt: string;
  updatedAt: string;
}

export interface Address {
  _id: string;
  address: string;
  city: City;
  province: Province;
  postalCode: string | null;
  plaque: string | null;
  lat: string;
  lon: string;
  createdAt: string;
  updatedAt: string;
}

export interface ProductRequestShop {
  _id: string;
  shopName: string;
  address: Address;
  shopCode: number;
}

export interface Brand {
  _id: string;
  title_fa: string;
  title_en: string;
  url: string;
}

export interface Category {
  _id: string;
  title_fa: string;
  title_en: string;
  icon: string;
  imageUrl: string;
  description: string;
  variants: string[];
  hierarchy: string[];
  leaf: boolean;
  parent: string | null;
  deleted: boolean;
  createdAt: string;
  updatedAt: string;
  url: string;
  children: Category[];
}

export interface Dimensions {
  package_weight: number;
  package_height: number;
  package_length: number;
  package_width: number;
}

export interface ProductRequestSeller {
  _id: string;
  fullName: string;
}

export interface ProductRequest {
  requestPhotography: boolean;
  requestPhotosCount: number | null;
  expertReview: boolean;
  unboxingVideo: boolean;
  payment: unknown | null;
  requestStatus: string;
  _id: string;
  seller: ProductRequestSeller;
  shop: ProductRequestShop;
  brand: Brand;
  category: Category;
  source: string;
  productName: string;
  description: string;
  dimensions: Dimensions;
  advantages: string[];
  disAdvantages: string[];
}

export interface GetRequestCreateProductResponse {
  status: number;
  success: boolean;
  results: {
    productRequests: ProductRequest[];
    pager: Pager;
  };
}

export interface Learning {
  _id: string;
  title: string;
  description: string;
  videoUrl: string;
  cover: string;
  category: LearningCategory;
  deleted: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface GetLearningResponse {
  status: number;
  success: boolean;
  results: {
    learning: Learning[];
  };
}

export interface CreateLearningType {
  title: string;
  description: string;
  videoUrl: string;
  cover: string;
  category: string;
}

export interface ContractResponse {
  status: number;
  success: boolean;
  results: {
    contract: {
      _id: string;
      content: string;
      createdAt: string;
      updatedAt: string;
    };
  };
}

export interface UpdateContractType {
  id: string;
  content: string;
}

export interface ChangeStatusDocumentType {
  docsId: string;
  status: "Approved" | "REJECTED";
}
