// TODO: Veškeré interfaci refactorovat, protože jako je tu bordel
// udělat si jasno v tom, co bude number, string, undefined nebo null!!!

export enum AddressType {
	DeliveryAddress = 1,
	InvoicingAddress = 2
}

export enum DeliveryType {
	Pickup = 1,
	Delivery = 2
}

export interface jwtToken {
	unique_name: number,
	role: string,
	firstName: string,
	lastName: string,
	nbf: number,
	exp: number,
	iat: number
}

export interface IAccountInfo {
	firstName: string,
	lastName: string
}

export interface IAddress {
	id: number,
	firstName: string,
	lastName: string,
	email: string | undefined,
	phoneNumber: string,
	city: string,
	street: string,
	zipCode: string,
	addressTypeID?: number | string | undefined
}

// TODO: najit, nahradit IOrderItemVM a smazat | DUPLICITA
export interface IOrderItem {
	id: number,
	productID: number,
	name: string,
	price: number,
	productCategoryID?: number | undefined,
	productCategoryName: string,
	productImageID: number
}

export interface IOrderListQueryFilter {
	orderStateID?: number | undefined,
	userID: number
}

export interface IOrderVM {
	id: number,
	totalPrice: number,
	deliveryType: string,
	orderState: string,
	paymentType: string,
	orderItemsCount: number,
	orderedDate: Date
}

export interface IOrderDetailVM {
	id: number,
	deliveryAddress: IAddress,
	invoicingAddress: IAddress,
	orderItems: IOrderItemVM[],
	deliveryType: string,
	orderState: string,
	paymentState: string,
	paymentType: string,
	orderedDate: Date,
	totalPrice: number
}

export interface IOrderItemVM {
	id: number,
	productID: number,
	name: string,
	amount: number,
	price: number,
	totalPrice: number,
	imageID: number
}

export interface IPagedQueryResult<T> {
	data: T[],
	totalCount: number
}

export interface IProductCategoryItem {
	id: number,
	name: string,
	description: string,
	parentID: number,
	descendants: IProductCategoryItem[]
}

export interface IPasswordChange {
	oldPassword: string,
	password: string,
	confirmPassword: string
}

export interface IProductItem {
	id: number,
	name: string,
	price: number,
	availableQuantity: number,
	reducedPrice?: number | undefined,
	description: string,
	productCategoryID?: number | undefined,
	productCategoryName: string,
	productImageIDs: number[]
}

export interface IProductImage {
	id: number,
	name: string,
	storageName: string
}

export interface IProductListQueryFilter {
	productCategoryId: number | string | undefined,
	searchString: string
}

export interface IProductInStockDto {
	id: number,
	name: string,
	count: number,
	errorMessage: string
}

// new order view model
export interface INewOrder {
	orderNumber: number,
	totalPrice: number,
	errorMessage: string
}

export interface IInvoicingAddress {
	id?: number | undefined,
	firstName: string,
	lastName: string,
	email: string | undefined,
	phoneNumber: string,
	city: string,
	street: string,
	zipCode: string
}

export interface IDeliveryAddress {
	id?: number | undefined,
	firstName: string,
	lastName: string,
	phoneNumber: string,
	city: string,
	street: string,
	zipCode: string
}

export interface ILoginIM {
	email: string,
	password: string
}

export interface IRegisterIM {
	email: string,
	password: string,
	confirmPassword: string
}

export interface IPassword {
	password: string,
	confirmPassword: string
}

export interface IDeliveryType {
	id: number,
	name: string,
	fee: number
}

export interface IPaymentType {
	id: number,
	name: string,
	fee: number
}

export interface IShoppingCartItem {
	id?: number | undefined,
	productID: number,
	name: string,
	price: number,
	amount: number,
	availableQuantity: number,
	productCategoryID?: number | undefined,
	productCategoryName: string,
	productImageID?: number | undefined
}

// is this ok?
export interface IShoppingCartStorageItem {
	productID: number,
	amount: number
}

export interface IShoppingCartStorage {
	items: IShoppingCartStorageItem[]
}

export interface ISortItem {
	direction: string,
	expression: string
}