export type CategoryType = {
  title_fa: string;
  title_en: string;
  icon: string;
  imageUrl: string;
  description: string;
  parent: string | null;
  theme?: string;
};

export type CategoryResponseType = {
  id: string;
  title_fa: string;
  title_en: string;
  icon: string;
  imageUrl: string;
  description: string;
  parent: string;
  createdAt: string;
  updatedAt: string;
};

export type CreateCategoryRequestType = CategoryType;

export type UpdateCategoryRequestType = Partial<CategoryType>;

export type UploadFileResponseType = {
  originalname: string;
  size: number;
  url: string;
  type: string;
};

export type SingleUploadResponseType = {
  status: number;
  success: boolean;
  results: {
    message: string;
    url: UploadFileResponseType;
  };
};

// تایپ‌های جدید برای ساختار درختی دسته‌بندی‌ها
export type CategoryTreeNode = {
  _id: string;
  title_fa: string;
  title_en: string;
  icon: string;
  imageUrl: string;
  description: string;
  variants: number[];
  hierarchy: string[];
  leaf: boolean;
  parent: string | null;
  deleted: boolean;
  createdAt: string;
  updatedAt: string;
  url: string;
  theme?: string;
  children: CategoryTreeNode[];
};

export type CategoriesResponseType = {
  status: number;
  success: boolean;
  results: {
    data: CategoryTreeNode[];
  };
};

export type CategoryByIdResponseType = {
  status: number;
  success: boolean;
  results: {
    data: CategoryTreeNode;
  };
};

export type ColorType = {
  name: string;
  hexColor: string;
};

export type SizeType = {
  value: string;
};

export type MeterageType = {
  value: string;
};

export type ProductVariantType = {
  theme: string;
  colors?: ColorType[];
  sizes?: SizeType[];
  meterages?: MeterageType[];
};

// تایپ‌های جدید برای variants دسته‌بندی
export type VariantType = {
  _id: number;
  value: string;
};

export type ColorVariantType = {
  name: string;
  hexColor: string;
};

export type CategoryVariantsType = {
  id: string;
  theme: string;
  sizes?: VariantType[];
  colors?: ColorVariantType[];
  meterages?: VariantType[];
};

export type CategoryWithVariantsType = {
  _id: string;
  title_fa: string;
  title_en: string;
  theme: string;
  icon: string;
  imageUrl: string;
  description: string;
  leaf: boolean;
  categoryVariants: CategoryVariantsType;
};

export type CategoryVariantsResponseType = {
  status: number;
  success: boolean;
  results: {
    data: {
      category: CategoryWithVariantsType;
    };
  };
};

export type CreateCategoryAttributeType = {
  title: string;
  type: string;
  multiple?: boolean;
  hint?: string;
  required: boolean;
  values: {
    text: string;
  }[];
};

export type CategoryAttributeType = {
  _id: number;
  title: string;
  type: string;
  multiple: boolean;
  hint: string;
  required: boolean;
  values: {
    _id: number;
    text: string;
  }[];
};

export type CategoryAttributesResponseType = {
  status: number;
  success: boolean;
  results: {
    data: {
      category: {
        category_title_fa: string[];
        attributes: CategoryAttributeType[];
      };
    };
  };
};
