export type Operators =
	| 'is'
	| 'isnot'
	| '>'
	| '<'
	| 'contains'
	| 'starts_with'
	| 'ends_with';

export type LogicType = 'all' | 'any';

export type ActionType = 'show' | 'hide';

export interface PricingCondition {
	fieldId: string;
	operator: Operators;
	value: string;
}

export interface PricingLevel {
	uuid: string;
	price: number | string;
	productId: number;
	conditionalLogic: {
		actionType: ActionType;
		logicType: LogicType;
		rules: PricingCondition[];
	};

	// used by the drag and drop lib.
	position?: number;
}

export interface Product {
	id: number;
	basePrice: string;
	label: string;
	pricingLevels: PricingLevel[];
}

interface WPResponse<D> {
	success: boolean;
	data: D;
}

export type PrepareImportFileResponse = WPResponse<{
	disambiguation: {
		columns: {
			name: string;
			index: number;
		}[];
		products: {
			name: string;
			slug: string;
		}[];
		rows: {
			index: number;
			values: { [columnIndex: number]: string };
		}[];
	};
	file_path: string;
}>;

export type GetImportFileResponse = WPResponse<{
	file_contents: Array<Array<string>>;
}>;
