export interface IBaseFeeRule {
  ID: string;
  code: string;
  rule: string;
  base: string;
  feeRate: number | null;
  labour: number | null;
  material: number | null;
  machine: number | null;
}

// 费用章节
export interface IStdInstallSection {
  rationRepId: number;
  ID: string;
  feeItemId: string;
  name: string;
  feeRule: IBaseFeeRule[];
  deleted: boolean;
  seq: number; // 排序
}
// 费用项
export interface IStdInstallFeeItem {
  rationRepId: number;
  ID: string;
  feeItem: string; // 费用项
  feeType: string; // 费用类型
  position: string; // 记取位置
  section: [];
  deleted: boolean;
  seq: number; // 排序
}

// 安装增加费-费用规则
export interface IFeeRule extends IBaseFeeRule {
  sectionID: string; // 分册章节id
  feeItemID: string;
  position?: string; // 记取位置
  billID?: string; // 记取位置对应的清单ID
  isAdd?: boolean; // 是否新增
}

// 安装增加费-分册章节
export interface IInstallSection {
  ID: string;
  feeItemID: string;
  feeRuleID: string;
  name: string;
  seq: number; // 排序
}

// 安装增加费-费用项
export interface IInstallFeeItem {
  ID: string;
  feeItem: string; // 费用项
  feeType: string; // 费用类型
  position: string; // 记取位置
  billID?: string; // 记取位置对应的清单ID
  isCalc: boolean; // 是否记取
  seq: number; // 排序
}

export enum FeeItemCalcType {
  PROJECT_CALC = 'project_calc', // 整个项目统一计取
  FB_CALC = 'FB_calc', // 每个分部单独计取
}

export interface IInstallationFee {
  ID: string;
  libID: number;
  libName: string;
  projectID: string;
  calcType: FeeItemCalcType; // 分项费用计取方式
  coverSetting?: boolean; // 是否覆盖设置
  installFeeItems: IInstallFeeItem[];
  installSections: IInstallSection[];
  feeRules: IFeeRule[];
}
