import type { CashSessionOperationType, CashSessionStatus } from "../enums.js"
import type { CashSessionOperationDepositLineDto } from "./deposit.dto.js"

export interface CashSessionCountEntryDto {
    denomination: number
    quantity: number
    kind: "coin" | "bill"
}

export interface CashSessionCountBreakdownDto {
    entries: CashSessionCountEntryDto[]
    freeAmount: number
    total: number
}

export interface CashSessionDto {
    id: string
    shopId: string | null
    status: CashSessionStatus
    openingCash: number
    openingCountBreakdown: CashSessionCountBreakdownDto | null
    closingCash: number | null
    openedAt: string | null
    closedAt: string | null
    nextOrderNumber: number | null
    stationId: string | null
    stationName: string | null
    openedByName: string | null
    closedByName: string | null
    orderCount: number
    expectedCash: number
    paymentImpactTotal: number
    manualImpactTotal: number
    difference: number | null
    closingCountBreakdown: CashSessionCountBreakdownDto | null
}

export interface CashSessionOperationDto {
    id: string
    cashSessionId: string
    shopId: string | null
    type: CashSessionOperationType
    createdById: string | null
    linkedOrderId?: string | null
    depositLines: CashSessionOperationDepositLineDto[]
    source: string | null
    note: string | null
    amountDelta: number | null
    countsTowardExpectedCash: boolean
    resultingExpectedCash: number | null
    createdAt: string
    createdByName: string | null
}

export interface CreateCashSessionOperationResultDto {
    session: CashSessionDto
    operation: CashSessionOperationDto
}

