import { CertificateType } from './Certificate';

export type PlatformType = 'AMAZON' | 'EBAY' | 'SHOPEE' | 'ALIEXPRESS' | 'TIKTOK' | 'TEMU';

export type ProductCategory = 
  | 'ELECTRONICS'
  | 'TOYS'
  | 'COSMETICS'
  | 'FOOD'
  | 'MEDICAL'
  | 'TEXTILES'
  | 'FURNITURE'
  | 'SPORTS'
  | 'AUTOMOTIVE'
  | 'JEWELRY'
  | 'BOOKS'
  | 'HOME_APPLIANCES'
  | 'OTHER';

export type ComplianceLevel = 'REQUIRED' | 'RECOMMENDED' | 'OPTIONAL';

export interface ComplianceRule {
  id?: string;
  tenantId?: string;
  platform: PlatformType;
  productCategory: ProductCategory;
  targetMarket?: string;
  requiredCertificates: CertificateType[];
  complianceLevel: ComplianceLevel;
  description?: string;
  isActive: boolean;
  createdAt?: Date;
  updatedAt?: Date;
}

export interface ComplianceRuleCreateInput {
  tenantId?: string;
  platform: PlatformType;
  productCategory: ProductCategory;
  targetMarket?: string;
  requiredCertificates: CertificateType[];
  complianceLevel: ComplianceLevel;
  description?: string;
  isActive?: boolean;
}

export interface ComplianceCheckInput {
  tenantId: string;
  shopId: string;
  taskId?: string;
  traceId: string;
  businessType: 'TOC' | 'TOB';
  productId: string;
  platform: PlatformType;
  productCategory?: ProductCategory;
  targetMarket?: string;
}

export interface ComplianceCheckResult {
  isCompliant: boolean;
  productId: string;
  platform: PlatformType;
  checkedAt: Date;
  requiredCertificates: CertificateType[];
  existingCertificates: CertificateType[];
  missingCertificates: CertificateType[];
  expiredCertificates: CertificateType[];
  complianceLevel: ComplianceLevel;
  suggestions: string[];
  traceId: string;
}

export interface ComplianceRuleQueryOptions {
  tenantId?: string;
  platform?: PlatformType;
  productCategory?: ProductCategory;
  targetMarket?: string;
  isActive?: boolean;
  page?: number;
  pageSize?: number;
}
