@startuml
!include theme.puml
title Vendure Class Diagram

class Channel {
    name: string
    defaultLanguageCode: LanguageCode
    defaultCurrencyCode: CurrencyCode
}
class User {
    identifier: string
    passwordHash: string
    roles: UserRole[]
}
class Customer {
    user: User
    addresses: Address[]
    orders: Order[]
}
class Administrator {
    user: User
}
class Role {
    name: string
    permissions: Permission[]
    user: User
    channel: Channel
}
enum Permission {
    CreateCatalog
    ReadCatalog
    UpdateCatalog
    DeleteCatalog
    CreateUser
    ...etc
}
class Address {
}
class Product {
    variants: ProductVariant[]
    assets: Asset[]
}
class ProductOptionGroup
class ProductOption {
    group: ProductOptionGroup
}
class ProductVariant {
    sku: string
    assets: Asset[]
    price: ProductVariantPrice[]
}
class ProductVariantPrice {
    value: number
    currencyCode: CurrencyCode
}
class Order {
    lines: OrderLine[]
}
class OrderLine {
    items: OrderItem[]
}
class OrderItem {
    order: Order
    productVariant: ProductVariant
}
class Adjustment {
    target: OrderItem | Order
    source: AdjustmentSource
}
enum AdjustmentType {
    Tax
    Promotion
}
class AdjustmentSource {
    type: AdjustmentType
}
class Facet {
    values: FacetValue[]
}
class FacetValue {
}
class Category {
}
class Asset {
}

Customer --  User
Administrator -- User
User o-- Role
Role o-- "1..*" Permission
Role -- Channel
Customer *-- "0..*" Address
Product *-- "1..*" ProductVariant
Product *-- "0..*" Asset
ProductOptionGroup *-- "1..*" ProductOption
Product o-- "0..*" ProductOptionGroup
ProductVariant o-- "0..*" ProductOption
ProductVariant o-- "0..*" FacetValue
ProductVariant o-- "0..*" Asset
Facet *-- "1..*" FacetValue
Category o-- "1..*" FacetValue
Customer *-- "0..*" Order
OrderLine - ProductVariant
Order *-- OrderLine
OrderLine *-- OrderItem
Order -- Channel
OrderItem o-- Adjustment
Order o-- Adjustment
Adjustment - AdjustmentType
Adjustment o-- AdjustmentSource
AdjustmentSource - AdjustmentType
AdjustmentSource o-- Channel
Product o-- Channel
ProductVariant *-- "1..*" ProductVariantPrice
ProductVariantPrice o-- Channel
ProductVariantPrice "taxCategory" -- AdjustmentSource

@enduml
