import { GenderEnum, ImageVariationEnum, ImageTypeEnum, RoleEnum, PermissionEnum } from '@vini-wine/core-enums';

interface PriceDto {
    currency: string;
    priceMicros: number;
    visibility?: {
        id: string | null;
    };
}

interface B2bMarketPriceDto {
    price: PriceDto | null;
    updatedAt: Date;
}

interface CountryDto {
    codeAlpha2: string;
}

interface GenderDto {
    id: GenderEnum;
    name: string;
}

interface ImageDto {
    name: string;
    mime: string;
    height: number;
    width: number;
    url: string;
    variation: {
        id: ImageVariationEnum;
    };
    type: {
        id: ImageTypeEnum;
    };
    size: number;
}

interface VatTaxDto {
    value: string;
    countryCode: string;
}

interface RoleDto {
    id: RoleEnum;
    permissions?: PermissionDto[];
}

interface PermissionDto {
    id: PermissionEnum;
    roles?: RoleDto[];
}

interface PersonDto {
    uuid: string;
    firstName: string;
    lastName: string;
    preferredLanguage: string;
    preferredCurrency?: string;
    gender: GenderDto;
}

interface UserAccountDto {
    uuid: string;
    status: {
        id: number | string;
    };
    email: string;
    emailVerified: boolean;
    lastLoginAt?: Date;
    tourSkippedAt?: Date | null;
    defaultTimezone?: string;
    defaultDateTimeFormat?: string;
    createdAt?: Date;
    updatedAt?: Date;
    person: PersonDto;
    selectedUserOrganisation?: UserOrganisationDto | null;
    userOrganisations?: UserOrganisationDto[];
    permissions?: PermissionDto[];
    roles?: RoleDto[];
    numNotificationsUnPreRead?: number;
    avatar?: ImageDto | null;
}

interface UserOrganisationDto {
    isUserDefaultOrganisation?: boolean;
    isOrganisationOwner?: boolean;
    status?: {
        id: number | string;
    };
    createdAt: Date;
    organisation: OrganisationDto;
    user?: UserAccountDto;
    permissions?: PermissionDto[];
    roles?: RoleDto[];
}

interface OrganisationDto {
    defaultTimezone?: string;
    legalName: string;
    name: string;
    uuid: string;
    vatTax: VatTaxDto;
    defaultSalesContactUserOrganisation?: UserOrganisationDto;
}

interface SellerDto {
    name?: string;
    uuid: string;
    organisation?: OrganisationDto;
}

interface SupplierDto {
    name: string;
    uuid: string;
    supplierOrganisation?: OrganisationDto;
}

interface WineTypeDto {
    id?: number;
    uuid?: string;
    name: string;
}

interface WineryDto {
    id?: number;
    uuid?: string;
    name: string;
}

interface RegionDto {
    id?: number;
    uuid?: string;
    name: string;
    country?: CountryDto;
}

interface WineDto {
    id?: number;
    uuid?: string;
    name: string;
    wineType?: WineTypeDto;
    region?: RegionDto;
    winery?: WineryDto;
}

interface VintageDto {
    uuid: string;
    year: number;
    wine?: WineDto;
    bottleImage?: ImageDto | null;
}

interface VintageProductDto {
    milliliters: number;
    uuid: string;
    vintage?: VintageDto;
    b2bMarketPrice?: B2bMarketPriceDto;
}

interface UploadDto {
    uuid: string;
    name: string;
}

interface OfferDto {
    uuid: string;
    createdAt: Date;
    package?: string | null;
    price: PriceDto | null;
    quantity: number;
    seller?: SellerDto;
    supplier?: SupplierDto;
    shippedFromCountry?: CountryDto | null;
    vintageProducts?: VintageProductDto[];
    upload?: UploadDto;
    isSharedOffer?: boolean;
}

export type { B2bMarketPriceDto, CountryDto, GenderDto, ImageDto, OfferDto, OrganisationDto, PermissionDto, PersonDto, PriceDto, RegionDto, RoleDto, SellerDto, SupplierDto, UploadDto, UserAccountDto, UserOrganisationDto, VatTaxDto, VintageDto, VintageProductDto, WineDto, WineTypeDto, WineryDto };
