export type StoreModuleIcon = "sectors" | "truck" | "trend" | "book" | "invoice";

export type StoreModuleStatus = "available" | "active" | "ending" | "locked";

export interface AdminStoreModule {
  id: number;
  key: string;
  name: string;
  tagline: string;
  problem: string;
  solution: string;
  gains: string[];
  where: string[];
  needs: string | null;
  icon: StoreModuleIcon;
  category: string;
  path: string;
  price_ht: number;
  published: boolean;
  position: number;
  available_on_server: boolean;
  active_companies: number;
  updated_at: string | null;
}

export type UpdateStoreModulePayload = Partial<
  Pick<AdminStoreModule, "name" | "tagline" | "problem" | "solution" | "gains" | "needs" | "category" | "price_ht" | "published" | "position">
>;

export interface StoreModuleActivation {
  activated_at: string;
  ends_at: string | null;
  activated_by: string | null;
}

export interface AdminCompanyModule {
  key: string;
  name: string;
  price_ht: number;
  discount_percent: number;
  discount_note: string | null;
  final_price_ht: number;
  status: StoreModuleStatus;
  activated_at: string | null;
  ends_at: string | null;
  history: StoreModuleActivation[];
}

export interface CompanyStore {
  company: { id: number; name: string };
  modules: AdminCompanyModule[];
}

export interface SetStoreDiscountPayload {
  percent: number;
  note?: string | null;
}
