import { Populated } from '../core/mongoose.js';
import { AptlyAddress, AptlySearchAddress } from './address.js';
import { AptlyAllowance, AptlyAllowanceChargeSchema, AptlyExtensionAmount, AptlyLegalMonetaryTotal } from './algorithm.js';
import { AptlyCustomer, AptlyCustomerSchema } from './customer.js';
import { AptlyDocumentSchema } from './document.js';
import { AptlyBaseSchema } from './extends.js';
import { AptlyOptionPopulatedSchema, AptlyOptionSchema } from './option.js';
import { AptlyOrderPaymentStatus, AptlyOrderSchema } from './order.js';
import { AptlyOrganization, AptlyOrganizationSchema } from './organization.js';
import { AptlyPickSchema } from './pick.js';
import { AptlyProjectSchema } from './project.js';
import { AptlyUnitSchema } from './unit.js';
import { AptlyUserSchema } from './user.js';
import { AptlyCategorySchema } from './category';
export type AptlyOffer = AptlyOfferSchema<string, string>;
export interface AptlyOfferSchema<ID, DATE> extends AptlyBaseSchema<ID, DATE>, Omit<AptlyExtensionAmount, 'currency'> {
    organization: ID | AptlyOrganizationSchema<ID, DATE>;
    project: ID | AptlyProjectSchema<ID, DATE>;
    unit: ID | AptlyUnitSchema<ID, DATE> | null;
    order: ID | AptlyOrderSchema<ID, DATE> | null;
    document: ID | AptlyDocumentSchema<ID, DATE> | null;
    categories: (ID | AptlyCategorySchema<ID, DATE>)[];
    createdBy: Populated<AptlyUserSchema<ID, DATE>> | null;
    expiresAt: DATE | null;
    sentAt: DATE | null;
    number: number;
    description: string;
    identification: string;
    amount: number | null;
    allowance?: AptlyAllowance | null;
    algorithm: ID | null;
    items: AptlyOfferItemSchema<ID, DATE>[];
    customer: AptlyCustomerSchema<ID, DATE> | null;
    shipping: AptlyAddress | null;
    openedAt: DATE | null;
    acceptedAt: DATE | null;
    acceptedBy: ID | AptlyUserSchema<ID, DATE> | null;
    locked: boolean;
}
export type AptlyOfferItem = AptlyOfferItemSchema<string, string>;
export interface AptlyOfferItemSchema<ID, DATE> {
    _id: ID;
    option: ID | AptlyOptionSchema<ID, DATE>;
    quantity: number;
    amount: number;
    title?: string;
    algorithm: ID | null;
    note: string;
    createdAt?: DATE;
    index: number;
    allowance?: AptlyAllowance | null;
}
export type AptlyUserOffer = AptlyUserOfferSchema<string, string>;
export interface AptlyUserOfferSchema<ID, DATE> extends Omit<AptlyOfferSchema<ID, DATE>, 'amount' | 'items'> {
    options: AptlyOptionPopulatedSchema<ID, DATE>[];
    picks?: AptlyPickSchema<ID, DATE>[];
}
export interface AptlyOfferSendUnitBody {
    unit: string;
}
export interface AptlyOfferSendPrivateBody extends Omit<AptlyCustomer, 'fullName' | 'user'> {
    unit: string | null;
    address: AptlySearchAddress | null;
}
export interface AptlyOfferSendCompanyBody extends Omit<AptlyCustomer, 'fullName' | 'user'> {
    company: Pick<AptlyOrganization, 'name' | 'vat' | 'address'>;
    address: AptlyAddress;
}
export type AptlyPublicOfferCheckout = AptlyPublicOfferCheckoutSchema<string, string>;
export interface AptlyPublicOfferCheckoutSchema<ID, DATE> extends AptlyExtensionAmount {
    status: AptlyOrderPaymentStatus;
    offer: Omit<AptlyUserOfferSchema<ID, DATE>, 'options'>;
    options: AptlyOptionPopulatedSchema<ID, DATE>[];
    organization: Pick<AptlyOrganizationSchema<ID, DATE>, 'name'>;
    project: Pick<AptlyProjectSchema<ID, DATE>, 'name' | 'paymentApp' | 'signApp'>;
    order?: Pick<AptlyOrderSchema<ID, DATE>, '_id' | 'status' | 'paymentSession'>;
    actions: {
        payment?: {
            active: boolean;
        };
        sign?: {
            active: boolean;
        };
        confirm?: {
            active: boolean;
        };
    };
    total: AptlyLegalMonetaryTotal;
    allowanceCharges: AptlyAllowanceChargeSchema<ID, boolean>[];
}
