import * as Models from './'

export const ItemRequestPriority = [
	'low',
	'standard',
	'high',
	'highest'
] as const
export type ItemRequestPriorityTuple = typeof ItemRequestPriority
export type ItemRequestPriority = ItemRequestPriorityTuple[number]

export const ItemRequestDestination = ['Svařovna'] as const
export type ItemRequestDestinationTuple = typeof ItemRequestDestination
export type ItemRequestDestination = ItemRequestDestinationTuple[number]

export interface ErrorData {
	errors: string[]
	warnings: string[]
}

export default interface ItemRequest {
	id: number
	name: string
	description: string | null
	priority: ItemRequestPriority
	orderMethod: string
	destination: string
	deadline: Date
	comment: string | null
	baseId: number
	supplierEshop: string | null
	supplierId: number | null
	attachmentId: number | null
	supervisorId: string | null
	approverId: string | null
	purchaserId: string | null

	itemBase?: Models.ItemBase
	supplier?: Models.Supplier
	approvals?: Models.Approval[]
	delays?: Models.Delay[]
	subitems?: number[]
	orders?: Models.Order[]
	inspections?: Models.Inspection[]
	attachment?: Models.File
	supervisor?: Models.User
	approver?: Models.User
	purchaser?: Models.User

	requestorName?: string
	statusId?: Models.StatusId
	statusName?: string
	uid?: string
	isActive?: boolean
	attachmentName?: string
	totalPrice?: number
	delayedDeadline?: Date
	currOrder?: Models.Order
	errorData?: ErrorData
}
