import { ServiceType } from "./tariff"; export type Discount = { ID: string; Name: string; Layer: number; Description: string; Condition: { Period?: { From: string; To: string; }; User?: string; UserType?: string; Coupon?: string; PurchasesAmount?: number; CartPurchasesAmount?: number; Product?: string; Term?: string; Usage?: string; PriceFrom?: number; Group?: string; }; Target: { Products?: { ID: string; Factor: number; Overhelm: boolean; }[]; Factor?: number; TargetScope?: string; TargetGroup?: string; Overhelm?: boolean; }; Audit: { UpdatedAt: string; CreatedAt: string; DeletedAt: string; Deleted: boolean; }; Deprecated: boolean; }; export type GetDiscountResponse = { Discounts: Discount[]; }; export const discountTypes = { "purchasesAmount": "Лояльность", "cartPurchasesAmount": "Корзина", "service": "Сервис", "privilege": "Товар", } as const; export type DiscountType = keyof typeof discountTypes; export type CreateDiscountBody = { Name: string; Layer: 1 | 2 | 3 | 4; Description: string; Condition: { Period: { /** ISO string */ From: string; /** ISO string */ To: string; }; User: string; UserType: string; Coupon: string; PurchasesAmount: number; CartPurchasesAmount: number; Product: string; Term: number; Usage: number; PriceFrom: number; Group: ServiceType | ""; }; Target: { Factor: number; TargetScope: "Sum" | "Group" | "Each"; Overhelm: boolean; TargetGroup: ServiceType | ""; Products: [{ ID: string; Factor: number; Overhelm: false; }]; }; };