61 lines
1.5 KiB
V
61 lines
1.5 KiB
V
module marketplace
|
|
|
|
import base
|
|
import freeflowuniverse.herolib.data.ourtime
|
|
import asset // For AssetType
|
|
// ListingStatus, ListingType enums and Bid struct are used from the same module
|
|
|
|
// Listing represents a marketplace listing for an asset
|
|
pub struct Listing {
|
|
base.Base // Provides id, created_at, updated_at
|
|
pub mut:
|
|
title string
|
|
description string
|
|
asset_id string
|
|
asset_type asset.AssetType // Enum from the asset model
|
|
seller_id string
|
|
price f64 // Initial price for fixed price, or starting price for auction
|
|
currency string
|
|
listing_type ListingType
|
|
status ListingStatus
|
|
expires_at ourtime.OurTime // Optional
|
|
sold_at ourtime.OurTime // Optional
|
|
buyer_id string // Optional
|
|
sale_price f64 // Optional
|
|
bids []Bid // List of bids for auction type listings
|
|
tags []string
|
|
image_url string // Optional
|
|
}
|
|
|
|
// ListingStatus defines the status of a marketplace listing
|
|
pub enum ListingStatus {
|
|
active
|
|
sold
|
|
cancelled
|
|
expired
|
|
}
|
|
|
|
// ListingType defines the type of marketplace listing
|
|
pub enum ListingType {
|
|
fixed_price
|
|
auction
|
|
exchange
|
|
}
|
|
|
|
// Bid represents a bid on an auction listing
|
|
pub struct Bid {
|
|
pub mut:
|
|
listing_id string // ID of the listing this bid belongs to
|
|
bidder_id u32
|
|
amount f64
|
|
currency string
|
|
status BidStatus
|
|
}
|
|
|
|
// BidStatus defines the status of a bid on an auction listing
|
|
pub enum BidStatus {
|
|
active
|
|
accepted
|
|
rejected
|
|
cancelled
|
|
} |