Update git remote URL from git.threefold.info to git.ourworld.tf
This commit is contained in:
		@@ -1,12 +0,0 @@
 | 
			
		||||
module base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// our attempt to make a message object which can be used for email as well as chat
 | 
			
		||||
pub struct Base {
 | 
			
		||||
pub mut:
 | 
			
		||||
	id            u32
 | 
			
		||||
	creation_time ourtime.OurTime
 | 
			
		||||
	mod_time      ourtime.OurTime // Last modified time
 | 
			
		||||
	comments      []u32
 | 
			
		||||
}
 | 
			
		||||
@@ -1,17 +1,34 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// CompanyStatus represents the status of a company
 | 
			
		||||
pub enum CompanyStatus {
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	suspended
 | 
			
		||||
// Company represents a business entity with all necessary details
 | 
			
		||||
pub struct Company {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name                string // Company legal name @[index: 'company_name_idx']
 | 
			
		||||
	registration_number string // Official registration number @[index: 'company_reg_idx']
 | 
			
		||||
	incorporation_date  u64    // Unix timestamp
 | 
			
		||||
	fiscal_year_end     string // Format: MM-DD
 | 
			
		||||
	email               string
 | 
			
		||||
	phone               string
 | 
			
		||||
	website             string
 | 
			
		||||
	address             string
 | 
			
		||||
	business_type       BusinessType
 | 
			
		||||
	industry            string // Industry classification
 | 
			
		||||
	description         string // Company description
 | 
			
		||||
	status              CompanyStatus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// BusinessType represents the type of a business
 | 
			
		||||
// CompanyStatus tracks the operational state of a company
 | 
			
		||||
pub enum CompanyStatus {
 | 
			
		||||
	pending_payment
 | 
			
		||||
	active
 | 
			
		||||
	suspended
 | 
			
		||||
	inactive
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// BusinessType categorizes the company structure
 | 
			
		||||
pub enum BusinessType {
 | 
			
		||||
	coop
 | 
			
		||||
	single
 | 
			
		||||
@@ -19,25 +36,3 @@ pub enum BusinessType {
 | 
			
		||||
	starter
 | 
			
		||||
	global
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Company represents a company registered in the Freezone
 | 
			
		||||
pub struct Company {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id u32 is provided by base.Base
 | 
			
		||||
	name                string
 | 
			
		||||
	registration_number string
 | 
			
		||||
	incorporation_date  ourtime.OurTime
 | 
			
		||||
	fiscal_year_end     string
 | 
			
		||||
	email               string
 | 
			
		||||
	phone               string
 | 
			
		||||
	website             string
 | 
			
		||||
	address             string
 | 
			
		||||
	business_type       BusinessType
 | 
			
		||||
	industry            string
 | 
			
		||||
	description         string
 | 
			
		||||
	status              CompanyStatus
 | 
			
		||||
	// created_at is provided by base.Base.creation_time
 | 
			
		||||
	// updated_at is provided by base.Base.mod_time
 | 
			
		||||
	shareholders        []Shareholder
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								specs/models/biz/payment.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								specs/models/biz/payment.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
module biz
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Payment handles financial transactions for companies
 | 
			
		||||
pub struct Payment {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	payment_intent_id  string // Stripe payment intent ID @[index: 'payment_intent_idx']
 | 
			
		||||
	company_id         u32    // Associated company @[index: 'payment_company_idx']
 | 
			
		||||
	payment_plan       string // monthly/yearly/two_year
 | 
			
		||||
	setup_fee          f64
 | 
			
		||||
	monthly_fee        f64
 | 
			
		||||
	total_amount       f64
 | 
			
		||||
	currency           string // Default: usd
 | 
			
		||||
	status             PaymentStatus
 | 
			
		||||
	stripe_customer_id string
 | 
			
		||||
	completed_at       u64 // Unix timestamp
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PaymentStatus tracks the lifecycle of a payment
 | 
			
		||||
pub enum PaymentStatus {
 | 
			
		||||
	pending
 | 
			
		||||
	processing
 | 
			
		||||
	completed
 | 
			
		||||
	failed
 | 
			
		||||
	refunded
 | 
			
		||||
}
 | 
			
		||||
@@ -1,44 +1,39 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.currency
 | 
			
		||||
// import freeflowuniverse.herolib.core.texttools { name_fix }
 | 
			
		||||
// Product represents goods or services offered by a company
 | 
			
		||||
pub struct Product {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name          string
 | 
			
		||||
	description   string
 | 
			
		||||
	price         f64
 | 
			
		||||
	type_         ProductType
 | 
			
		||||
	category      string
 | 
			
		||||
	status        ProductStatus
 | 
			
		||||
	max_amount    u16
 | 
			
		||||
	purchase_till u64 // Unix timestamp
 | 
			
		||||
	active_till   u64 // Unix timestamp
 | 
			
		||||
	components    []ProductComponent
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProductType represents the type of a product
 | 
			
		||||
// ProductComponent represents sub-parts of a complex product
 | 
			
		||||
pub struct ProductComponent {
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	quantity    u32
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProductType differentiates between products and services
 | 
			
		||||
pub enum ProductType {
 | 
			
		||||
	product
 | 
			
		||||
	service
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProductStatus represents the status of a product
 | 
			
		||||
// ProductStatus indicates availability
 | 
			
		||||
pub enum ProductStatus {
 | 
			
		||||
	available
 | 
			
		||||
	unavailable
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProductComponent represents a component or sub-part of a product.
 | 
			
		||||
// Its lifecycle is tied to the parent Product and it does not have its own independent ID.
 | 
			
		||||
pub struct ProductComponent {
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	quantity    int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Product represents a product or service offered
 | 
			
		||||
pub struct Product {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	name          string
 | 
			
		||||
	description   string
 | 
			
		||||
	price         currency.Currency
 | 
			
		||||
	type_         ProductType
 | 
			
		||||
	category      string
 | 
			
		||||
	status        ProductStatus
 | 
			
		||||
	max_amount    u16               // Maximum available quantity of this product, if applicable
 | 
			
		||||
	purchase_till ourtime.OurTime   // Date until which this product can be purchased
 | 
			
		||||
	active_till   ourtime.OurTime   // Date until which this product/service remains active (e.g., for subscriptions)
 | 
			
		||||
	components    []ProductComponent // List of components that make up this product
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,43 +1,35 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.currency
 | 
			
		||||
// Sale represents a transaction linking buyers to products
 | 
			
		||||
pub struct Sale {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id     u32
 | 
			
		||||
	buyer_id       u32
 | 
			
		||||
	transaction_id u32
 | 
			
		||||
	total_amount   f64
 | 
			
		||||
	status         SaleStatus
 | 
			
		||||
	sale_date      u64 // Unix timestamp
 | 
			
		||||
	items          []SaleItem
 | 
			
		||||
	notes          string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SaleStatus represents the status of a sale
 | 
			
		||||
// SaleItem captures product details at time of sale
 | 
			
		||||
pub struct SaleItem {
 | 
			
		||||
pub mut:
 | 
			
		||||
	product_id           u32
 | 
			
		||||
	name                 string // Product name snapshot
 | 
			
		||||
	quantity             i32
 | 
			
		||||
	unit_price           f64
 | 
			
		||||
	subtotal             f64
 | 
			
		||||
	service_active_until u64 // Optional service expiry
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SaleStatus tracks transaction state
 | 
			
		||||
pub enum SaleStatus {
 | 
			
		||||
	pending
 | 
			
		||||
	completed
 | 
			
		||||
	cancelled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Sale represents a sale of products or services
 | 
			
		||||
pub struct Sale {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id u32 is provided by base.Base
 | 
			
		||||
	company_id   u32                // Reference to Company.id that made the sale
 | 
			
		||||
	buyer_name   string
 | 
			
		||||
	buyer_email  string
 | 
			
		||||
	total_amount currency.Currency
 | 
			
		||||
	status       SaleStatus
 | 
			
		||||
	sale_date    ourtime.OurTime
 | 
			
		||||
	// created_at is provided by base.Base.creation_time
 | 
			
		||||
	// updated_at is provided by base.Base.mod_time
 | 
			
		||||
	items        []SaleItem
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SaleItem represents an individual item within a Sale.
 | 
			
		||||
// Its lifecycle is tied to the parent Sale.
 | 
			
		||||
pub struct SaleItem {
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id u32 - Removed, component of Sale
 | 
			
		||||
	// sale_id u32 - Removed, implicit link to parent Sale
 | 
			
		||||
	product_id  u32                // Reference to Product.id
 | 
			
		||||
	name        string             // Denormalized product name at time of sale
 | 
			
		||||
	quantity    int
 | 
			
		||||
	unit_price  currency.Currency  // Price per unit at time of sale
 | 
			
		||||
	subtotal    currency.Currency
 | 
			
		||||
	service_active_until ourtime.OurTime? // Optional: For services, date until this specific purchased instance is active
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,27 +1,22 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Shareholder tracks company ownership details
 | 
			
		||||
pub struct Shareholder {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id u32
 | 
			
		||||
	user_id    u32
 | 
			
		||||
	name       string
 | 
			
		||||
	shares     f64
 | 
			
		||||
	percentage f64
 | 
			
		||||
	type_      ShareholderType
 | 
			
		||||
	since      u64 // Unix timestamp
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ShareholderType represents the type of shareholder
 | 
			
		||||
// ShareholderType distinguishes between individual and corporate owners
 | 
			
		||||
pub enum ShareholderType {
 | 
			
		||||
	individual
 | 
			
		||||
	corporate
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Shareholder represents a shareholder of a company
 | 
			
		||||
pub struct Shareholder {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id u32 is provided by base.Base
 | 
			
		||||
	company_id u32                // Reference to Company.id
 | 
			
		||||
	user_id    u32                // Reference to User.id (if individual) or another entity ID (if corporate)
 | 
			
		||||
	name       string             // Denormalized name of the shareholder (user or corporate entity)
 | 
			
		||||
	shares     f64                // Number of shares held
 | 
			
		||||
	percentage f64                // Percentage of ownership
 | 
			
		||||
	type_      ShareholderType
 | 
			
		||||
	since      ourtime.OurTime    // Date since becoming a shareholder
 | 
			
		||||
	// created_at is provided by base.Base.creation_time
 | 
			
		||||
	// updated_at is provided by base.Base.mod_time
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
module biz
 | 
			
		||||
 | 
			
		||||
// DEPRECATED: This file is deprecated and should not be used.
 | 
			
		||||
// Please use circle.User instead, which has all the necessary fields for MCC functionality.
 | 
			
		||||
// The biz.User struct has been removed as per the specifications.
 | 
			
		||||
							
								
								
									
										15
									
								
								specs/models/calendar/calendar.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								specs/models/calendar/calendar.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
module calendar
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Calendar represents a calendar with events and scheduling capabilities
 | 
			
		||||
pub struct Calendar {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string @[index]
 | 
			
		||||
	description string
 | 
			
		||||
	color       string // hex color code
 | 
			
		||||
	timezone    string
 | 
			
		||||
	owner_id    u32 @[index]
 | 
			
		||||
	is_public   bool
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										36
									
								
								specs/models/calendar/contacts.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								specs/models/calendar/contacts.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
module calendar
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Contact represents a contact or address book entry
 | 
			
		||||
pub struct Contact {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string @[index]
 | 
			
		||||
	email       string @[index]
 | 
			
		||||
	phone       string
 | 
			
		||||
	address     string
 | 
			
		||||
	company     string
 | 
			
		||||
	job_title   string
 | 
			
		||||
	notes       string
 | 
			
		||||
	tags        []string
 | 
			
		||||
	birthday    u64
 | 
			
		||||
	is_favorite bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactGroup represents a group of contacts
 | 
			
		||||
pub struct ContactGroup {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string @[index]
 | 
			
		||||
	description string
 | 
			
		||||
	color       string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactGroupMembership links contacts to groups
 | 
			
		||||
pub struct ContactGroupMembership {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	contact_id u32 @[index]
 | 
			
		||||
	group_id   u32 @[index]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										53
									
								
								specs/models/calendar/event.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								specs/models/calendar/event.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
module calendar
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// EventStatus represents the current status of an event
 | 
			
		||||
pub enum EventStatus {
 | 
			
		||||
	scheduled
 | 
			
		||||
	ongoing
 | 
			
		||||
	completed
 | 
			
		||||
	cancelled
 | 
			
		||||
	postponed
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EventType categorizes different types of events
 | 
			
		||||
pub enum EventType {
 | 
			
		||||
	meeting
 | 
			
		||||
	appointment
 | 
			
		||||
	reminder
 | 
			
		||||
	task
 | 
			
		||||
	call
 | 
			
		||||
	conference
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Event represents a calendar event
 | 
			
		||||
pub struct Event {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	calendar_id     u32    @[index]
 | 
			
		||||
	title           string @[index]
 | 
			
		||||
	description     string
 | 
			
		||||
	start_time      u64 @[index]
 | 
			
		||||
	end_time        u64 @[index]
 | 
			
		||||
	location        string
 | 
			
		||||
	status          EventStatus
 | 
			
		||||
	event_type      EventType
 | 
			
		||||
	priority        u8 // 1-5 scale
 | 
			
		||||
	is_all_day      bool
 | 
			
		||||
	recurrence_rule string // RFC 5545 recurrence rule
 | 
			
		||||
	parent_event_id u32    // for recurring events
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EventParticipant represents a participant in an event
 | 
			
		||||
pub struct EventParticipant {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	event_id      u32    @[index]
 | 
			
		||||
	user_id       u32    @[index]
 | 
			
		||||
	email         string @[index]
 | 
			
		||||
	name          string
 | 
			
		||||
	role          string // attendee, organizer, optional
 | 
			
		||||
	status        string // accepted, declined, tentative, pending
 | 
			
		||||
	response_time u64
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										49
									
								
								specs/models/calendar/message.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								specs/models/calendar/message.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
module calendar
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// MessageStatus represents the delivery status of a message
 | 
			
		||||
pub enum MessageStatus {
 | 
			
		||||
	draft
 | 
			
		||||
	sent
 | 
			
		||||
	delivered
 | 
			
		||||
	read
 | 
			
		||||
	failed
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MessageType categorizes different types of messages
 | 
			
		||||
pub enum MessageType {
 | 
			
		||||
	email
 | 
			
		||||
	sms
 | 
			
		||||
	notification
 | 
			
		||||
	reminder
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Message represents a communication message
 | 
			
		||||
pub struct Message {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	sender_id    u32 @[index]
 | 
			
		||||
	recipient_id u32 @[index]
 | 
			
		||||
	subject      string
 | 
			
		||||
	body         string
 | 
			
		||||
	message_type MessageType
 | 
			
		||||
	status       MessageStatus
 | 
			
		||||
	scheduled_at u64
 | 
			
		||||
	sent_at      u64
 | 
			
		||||
	read_at      u64
 | 
			
		||||
	priority     u8       // 1-5 scale
 | 
			
		||||
	attachments  []string // file paths or URLs
 | 
			
		||||
	tags         []string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reminder represents a scheduled reminder
 | 
			
		||||
pub struct Reminder {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	event_id      u32 @[index]
 | 
			
		||||
	message       string
 | 
			
		||||
	reminder_time u64 @[index]
 | 
			
		||||
	is_sent       bool
 | 
			
		||||
	snooze_count  u8
 | 
			
		||||
}
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
// Attachment represents an attachment usable for any object
 | 
			
		||||
// such as email, chat, etc.
 | 
			
		||||
// It is a generic struct that can be used for any object
 | 
			
		||||
// that requires an attachment.
 | 
			
		||||
 | 
			
		||||
pub struct Attachment {
 | 
			
		||||
pub mut:
 | 
			
		||||
	filename     string
 | 
			
		||||
	content_type string
 | 
			
		||||
	hash         string // Hash of the attachment data
 | 
			
		||||
	size         u32    // Size in bytes
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								specs/models/circle/circle.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								specs/models/circle/circle.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Circle represents a circle entity with configuration and metadata
 | 
			
		||||
@[heap]
 | 
			
		||||
pub struct Circle {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string       // Human-readable name of the circle
 | 
			
		||||
	description string       // Detailed description of the circle's purpose
 | 
			
		||||
	domain      string       // Primary domain name for the circle @[index]
 | 
			
		||||
	config      CircleConfig // Configuration settings for the circle
 | 
			
		||||
	status      CircleStatus // Current operational status
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CircleConfig holds configuration settings for a circle
 | 
			
		||||
pub struct CircleConfig {
 | 
			
		||||
pub mut:
 | 
			
		||||
	max_members  u32    // Maximum number of members allowed
 | 
			
		||||
	allow_guests bool   // Whether to allow guest access
 | 
			
		||||
	auto_approve bool   // Whether new members are auto-approved
 | 
			
		||||
	theme        string // Visual theme identifier
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CircleStatus represents the operational status of a circle
 | 
			
		||||
pub enum CircleStatus {
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	suspended
 | 
			
		||||
	archived
 | 
			
		||||
}
 | 
			
		||||
@@ -1,39 +0,0 @@
 | 
			
		||||
module mcc
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//there is only 1 of this per circle called "configs"
 | 
			
		||||
pub struct Configs {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	configs  map[string]Config //string is namefixed
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//generic config per circle, can be more than 1
 | 
			
		||||
pub struct Config {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name string
 | 
			
		||||
	labels  []Label
 | 
			
		||||
	colors []Color
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub struct Label {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name  string
 | 
			
		||||
	comment string
 | 
			
		||||
	color u16
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pub struct Color {
 | 
			
		||||
	base.Base	
 | 
			
		||||
pub mut:
 | 
			
		||||
	id    u16
 | 
			
		||||
	name  string
 | 
			
		||||
	comment string
 | 
			
		||||
	colorcode string //hex color code
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
// Define the RecordType enum
 | 
			
		||||
pub enum RecordType {
 | 
			
		||||
	a
 | 
			
		||||
	aaa
 | 
			
		||||
	cname
 | 
			
		||||
	mx
 | 
			
		||||
	ns
 | 
			
		||||
	ptr
 | 
			
		||||
	soa
 | 
			
		||||
	srv
 | 
			
		||||
	txt
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Define the DomainNamespace struct, represents a full domain with all its records
 | 
			
		||||
pub struct DomainNameSpace {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	id          u32
 | 
			
		||||
	domain      string
 | 
			
		||||
	description string
 | 
			
		||||
	records     []Record
 | 
			
		||||
	admins      []u32 // IDs of the admins they need to exist as user in the circle
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Define the Record struct
 | 
			
		||||
pub struct Record {
 | 
			
		||||
pub mut:
 | 
			
		||||
	name     string
 | 
			
		||||
	text     string
 | 
			
		||||
	category RecordType
 | 
			
		||||
	addr     []string
 | 
			
		||||
}
 | 
			
		||||
@@ -1,12 +0,0 @@
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
// there is one group called "everyone" which is the default group for all members and their roles
 | 
			
		||||
pub struct Group {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string // name of the group in a circle, the one "everyone" is the default group
 | 
			
		||||
	description string // optional description
 | 
			
		||||
	members     []u32  // pointers to the members of this group
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								specs/models/circle/member.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								specs/models/circle/member.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Member represents a member within a circle
 | 
			
		||||
pub struct Member {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	circle_id   u32          // Reference to the circle this member belongs to @[index]
 | 
			
		||||
	user_id     u32          // Reference to the user entity @[index]
 | 
			
		||||
	role        MemberRole   // Member's role within the circle
 | 
			
		||||
	status      MemberStatus // Current membership status
 | 
			
		||||
	joined_at   u64          // Unix timestamp when member joined
 | 
			
		||||
	invited_by  u32          // User ID of who invited this member
 | 
			
		||||
	permissions []string     // List of custom permissions
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MemberRole defines the possible roles a member can have
 | 
			
		||||
pub enum MemberRole {
 | 
			
		||||
	owner
 | 
			
		||||
	admin
 | 
			
		||||
	moderator
 | 
			
		||||
	member
 | 
			
		||||
	guest
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MemberStatus represents the current status of membership
 | 
			
		||||
pub enum MemberStatus {
 | 
			
		||||
	active
 | 
			
		||||
	pending
 | 
			
		||||
	suspended
 | 
			
		||||
	removed
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								specs/models/circle/name.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								specs/models/circle/name.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Name represents a domain name configuration for a circle
 | 
			
		||||
pub struct Name {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	circle_id   u32      // Reference to the circle this name belongs to @[index]
 | 
			
		||||
	domain      string   // The actual domain name @[index]
 | 
			
		||||
	subdomain   string   // Optional subdomain
 | 
			
		||||
	record_type NameType // Type of DNS record
 | 
			
		||||
	value       string   // DNS record value/target
 | 
			
		||||
	priority    u32      // Priority for MX records
 | 
			
		||||
	ttl         u32      // Time to live in seconds
 | 
			
		||||
	is_active   bool     // Whether this record is currently active
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NameType defines the supported DNS record types
 | 
			
		||||
pub enum NameType {
 | 
			
		||||
	a
 | 
			
		||||
	aaaa
 | 
			
		||||
	cname
 | 
			
		||||
	mx
 | 
			
		||||
	txt
 | 
			
		||||
	srv
 | 
			
		||||
}
 | 
			
		||||
@@ -1,42 +0,0 @@
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
// Role represents the role of a member in a circle
 | 
			
		||||
pub enum Role {
 | 
			
		||||
	admin
 | 
			
		||||
	stakeholder
 | 
			
		||||
	member
 | 
			
		||||
	contributor
 | 
			
		||||
	guest
 | 
			
		||||
	external // means no right in this circle appart from we register this user
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UserPreferences represents user preferences for MCC
 | 
			
		||||
pub struct UserPreferences {
 | 
			
		||||
pub mut:
 | 
			
		||||
	default_calendar_id u32    // Default calendar ID
 | 
			
		||||
	default_view        string // Default view (day, week, month)
 | 
			
		||||
	email_signature     string // Default email signature
 | 
			
		||||
	theme               string // UI theme preference
 | 
			
		||||
	notifications       bool   // Enable/disable notifications
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// User represents a member of a circle
 | 
			
		||||
pub struct User {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string // name of the member as used in this circle
 | 
			
		||||
	description string // optional description which is relevant to this circle
 | 
			
		||||
	role        Role   // role of the member in the circle
 | 
			
		||||
	contact_ids []u32  // IDs of contacts linked to this member
 | 
			
		||||
	wallet_ids  []u32  // IDs of wallets owned by this member which are relevant to this circle
 | 
			
		||||
	pubkey      string // public key of the member as used in this circle
 | 
			
		||||
	
 | 
			
		||||
	// Additional fields needed for MCC functionality
 | 
			
		||||
	email       string // Primary email address
 | 
			
		||||
	timezone    string // User's preferred timezone
 | 
			
		||||
	preferences UserPreferences // User preferences for MCC
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										33
									
								
								specs/models/circle/wallet.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								specs/models/circle/wallet.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
module circle
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Wallet represents a wallet associated with a circle for financial operations
 | 
			
		||||
pub struct Wallet {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	circle_id     u32          // Reference to the circle this wallet belongs to @[index]
 | 
			
		||||
	address       string       // Blockchain address for this wallet @[index]
 | 
			
		||||
	type          WalletType   // Type of wallet (custodial/non-custodial)
 | 
			
		||||
	balance       f64          // Current balance in the wallet
 | 
			
		||||
	currency      string       // Currency type (e.g., "USD", "BTC", "ETH")
 | 
			
		||||
	is_primary    bool         // Whether this is the primary wallet for the circle
 | 
			
		||||
	status        WalletStatus // Current wallet status
 | 
			
		||||
	last_activity u64          // Unix timestamp of last transaction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WalletType defines the types of wallets supported
 | 
			
		||||
pub enum WalletType {
 | 
			
		||||
	custodial
 | 
			
		||||
	non_custodial
 | 
			
		||||
	hardware
 | 
			
		||||
	software
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WalletStatus represents the operational status of a wallet
 | 
			
		||||
pub enum WalletStatus {
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	frozen
 | 
			
		||||
	archived
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								specs/models/core/base.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								specs/models/core/base.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
module core
 | 
			
		||||
 | 
			
		||||
// BaseData provides common fields for all models
 | 
			
		||||
pub struct Base {
 | 
			
		||||
pub mut:
 | 
			
		||||
	id       u32
 | 
			
		||||
	created  u64 // Unix timestamp of creation
 | 
			
		||||
	updated  u64 // Unix timestamp of last update
 | 
			
		||||
	deleted  bool
 | 
			
		||||
	version  u32
 | 
			
		||||
	comments []Comment
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								specs/models/core/comment.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								specs/models/core/comment.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
module core
 | 
			
		||||
 | 
			
		||||
// Comment represents a generic comment that can be associated with any model
 | 
			
		||||
// It supports threaded conversations with parent/child relationships
 | 
			
		||||
pub struct Comment {
 | 
			
		||||
pub mut:
 | 
			
		||||
	// Unique identifier for the comment
 | 
			
		||||
	id u32 // Unique identifier for the comment @[index]
 | 
			
		||||
	// Timestamp when the comment was created
 | 
			
		||||
	created_at u64 // Timestamp when the comment was created
 | 
			
		||||
	// Timestamp when the comment was last updated
 | 
			
		||||
	updated_at u64 // Timestamp when the comment was last updated
 | 
			
		||||
	// ID of the user who posted this comment
 | 
			
		||||
	user_id u32 // ID of the user who posted this comment @[index]
 | 
			
		||||
	// The actual text content of the comment
 | 
			
		||||
	content string
 | 
			
		||||
	// Optional ID of the parent comment for threaded conversations
 | 
			
		||||
	// None indicates this is a top-level comment
 | 
			
		||||
	parent_comment_id u32
 | 
			
		||||
}
 | 
			
		||||
@@ -1,31 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// Account represents a business or organization.
 | 
			
		||||
// Enums like AccountType and AccountIndustry have been removed for broader applicability.
 | 
			
		||||
// Fields previously using these enums now use `string` type.
 | 
			
		||||
pub struct Account {
 | 
			
		||||
	base.Base // Base struct for common fields
 | 
			
		||||
pub mut:
 | 
			
		||||
	name              string
 | 
			
		||||
	typ                string             // Type of account (e.g., Customer, Partner) - formerly AccountType enum
 | 
			
		||||
	industry           string             // Industry of the account (e.g., Technology, Healthcare) - formerly AccountIndustry enum
 | 
			
		||||
	employees         u32
 | 
			
		||||
	annual_revenue    f64
 | 
			
		||||
	billing_street    string
 | 
			
		||||
	billing_city      string
 | 
			
		||||
	billing_state     string
 | 
			
		||||
	billing_postal_code string
 | 
			
		||||
	billing_country   string
 | 
			
		||||
	shipping_street   string
 | 
			
		||||
	shipping_city     string
 | 
			
		||||
	shipping_state    string
 | 
			
		||||
	shipping_postal_code string
 | 
			
		||||
	shipping_country  string
 | 
			
		||||
	description       string
 | 
			
		||||
	assigned_user_id  u32    // Reference to User
 | 
			
		||||
	created_by_id     u32    // Reference to User
 | 
			
		||||
	primary_contact_id u32?  // Optional: Reference to Contact
 | 
			
		||||
}
 | 
			
		||||
@@ -1,39 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// CallStatus represents the status of a call
 | 
			
		||||
pub enum CallStatus {
 | 
			
		||||
	planned
 | 
			
		||||
	held
 | 
			
		||||
	not_held
 | 
			
		||||
	canceled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CallDirection represents the direction of a call
 | 
			
		||||
pub enum CallDirection {
 | 
			
		||||
	outbound
 | 
			
		||||
	inbound
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Call represents a phone call in the CRM system
 | 
			
		||||
pub struct Call {
 | 
			
		||||
	base.Base // Base struct for common fields (id u32, creation_time, mod_time)
 | 
			
		||||
pub mut:
 | 
			
		||||
	name              string
 | 
			
		||||
	status            CallStatus
 | 
			
		||||
	direction         CallDirection
 | 
			
		||||
	date_start        ourtime.OurTime
 | 
			
		||||
	duration          u32    // Duration in minutes
 | 
			
		||||
	description       string
 | 
			
		||||
	parent_type       string // Can be 'Account', 'Contact', 'Lead', 'Opportunity', 'Case'
 | 
			
		||||
	parent_id         u32    // Reference to the parent entity
 | 
			
		||||
	account_id        u32    // Reference to Account
 | 
			
		||||
	contact_id        u32    // Reference to Contact
 | 
			
		||||
	lead_id           u32    // Reference to Lead
 | 
			
		||||
	phone_number      string
 | 
			
		||||
	recording_url     string // Optional
 | 
			
		||||
	assigned_user_id  u32    // Reference to User
 | 
			
		||||
	created_by_id     u32    // Reference to User
 | 
			
		||||
}
 | 
			
		||||
@@ -1,57 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// CampaignStatus represents the status of a marketing campaign
 | 
			
		||||
pub enum CampaignStatus {
 | 
			
		||||
	planning
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	complete
 | 
			
		||||
	canceled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CampaignType represents the type of a marketing campaign
 | 
			
		||||
pub enum CampaignType {
 | 
			
		||||
	email
 | 
			
		||||
	newsletter
 | 
			
		||||
	web
 | 
			
		||||
	television
 | 
			
		||||
	radio
 | 
			
		||||
	mail
 | 
			
		||||
	print
 | 
			
		||||
	social_media
 | 
			
		||||
	telemarketing
 | 
			
		||||
	event
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Campaign represents a marketing campaign in the CRM system
 | 
			
		||||
pub struct Campaign {
 | 
			
		||||
	base.Base // Base struct for common fields (id u32, creation_time, mod_time)
 | 
			
		||||
pub mut:
 | 
			
		||||
	name              string
 | 
			
		||||
	status            CampaignStatus
 | 
			
		||||
	type              CampaignType
 | 
			
		||||
	start_date        ourtime.OurTime
 | 
			
		||||
	end_date          ourtime.OurTime
 | 
			
		||||
	budget            f64
 | 
			
		||||
	expected_revenue  f64
 | 
			
		||||
	expected_cost     f64
 | 
			
		||||
	actual_cost       f64
 | 
			
		||||
	objective         string
 | 
			
		||||
	description       string
 | 
			
		||||
	target_audience   string
 | 
			
		||||
	sent_count        u32
 | 
			
		||||
	open_count        u32
 | 
			
		||||
	click_count       u32
 | 
			
		||||
	bounce_count      u32
 | 
			
		||||
	opt_out_count     u32
 | 
			
		||||
	lead_count        u32
 | 
			
		||||
	opportunity_count u32
 | 
			
		||||
	revenue           f64
 | 
			
		||||
	roi               f64    // Return on Investment
 | 
			
		||||
	assigned_user_id  u32    // Reference to User
 | 
			
		||||
	created_by_id     u32    // Reference to User
 | 
			
		||||
}
 | 
			
		||||
@@ -1,53 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// CaseStatus represents the status of a support case
 | 
			
		||||
pub enum CaseStatus {
 | 
			
		||||
	new
 | 
			
		||||
	assigned
 | 
			
		||||
	pending
 | 
			
		||||
	closed
 | 
			
		||||
	rejected
 | 
			
		||||
	duplicate
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CasePriority represents the priority of a support case
 | 
			
		||||
pub enum CasePriority {
 | 
			
		||||
	low
 | 
			
		||||
	medium
 | 
			
		||||
	high
 | 
			
		||||
	urgent
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CaseType represents the type of a support case
 | 
			
		||||
pub enum CaseType {
 | 
			
		||||
	question
 | 
			
		||||
	incident
 | 
			
		||||
	problem
 | 
			
		||||
	feature_request
 | 
			
		||||
	bug
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Case represents a customer support case in the CRM system
 | 
			
		||||
pub struct Case {
 | 
			
		||||
	base.Base // Base struct for common fields (id u32, creation_time, mod_time)
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id                u32 // Removed, provided by base.Base
 | 
			
		||||
	number            string  // Auto-generated case number (e.g., "C-00001")
 | 
			
		||||
	name              string
 | 
			
		||||
	status            CaseStatus
 | 
			
		||||
	priority          CasePriority
 | 
			
		||||
	type              CaseType
 | 
			
		||||
	account_id        u32     // Reference to Account
 | 
			
		||||
	contact_id        u32     // Reference to Contact
 | 
			
		||||
	description       string
 | 
			
		||||
	resolution        string  // Optional
 | 
			
		||||
	solution          string  // Optional
 | 
			
		||||
	resolved_at       ourtime.OurTime // Optional
 | 
			
		||||
	// created_at        ourtime.OurTime // Removed, provided by base.Base.creation_time
 | 
			
		||||
	// updated_at        ourtime.OurTime // Removed, provided by base.Base.mod_time
 | 
			
		||||
	assigned_user_id  u32     // Reference to User
 | 
			
		||||
	created_by_id     u32     // Reference to User
 | 
			
		||||
}
 | 
			
		||||
@@ -1,35 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// Contact represents an individual person in the CRM system.
 | 
			
		||||
pub struct Contact {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time
 | 
			
		||||
pub mut:
 | 
			
		||||
	first_name          string
 | 
			
		||||
	last_name           string
 | 
			
		||||
	title               string // e.g., Mr., Ms., Dr.
 | 
			
		||||
	email               string
 | 
			
		||||
	phone               string
 | 
			
		||||
	mobile              string
 | 
			
		||||
	job_title           string
 | 
			
		||||
	department          string // Optional
 | 
			
		||||
	// company_id       u32    // Optional: If directly linked to a primary company/account
 | 
			
		||||
	// reports_to_id    u32    // Optional: Contact ID of their manager
 | 
			
		||||
 | 
			
		||||
	// Address fields
 | 
			
		||||
	address_street      string
 | 
			
		||||
	address_city        string
 | 
			
		||||
	address_state       string
 | 
			
		||||
	address_postal_code string
 | 
			
		||||
	address_country     string
 | 
			
		||||
 | 
			
		||||
	description         string // General notes about the contact
 | 
			
		||||
	do_not_call         bool
 | 
			
		||||
	email_opt_out       bool
 | 
			
		||||
 | 
			
		||||
	// Social media profiles could be added here too
 | 
			
		||||
	// linkedin_profile string
 | 
			
		||||
	// twitter_profile  string
 | 
			
		||||
}
 | 
			
		||||
@@ -1,47 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// LeadStatus represents the status of a lead
 | 
			
		||||
pub enum LeadStatus {
 | 
			
		||||
	new
 | 
			
		||||
	assigned
 | 
			
		||||
	in_process
 | 
			
		||||
	converted
 | 
			
		||||
	recycled
 | 
			
		||||
	dead
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// LeadSource represents the source of a lead
 | 
			
		||||
pub enum LeadSource {
 | 
			
		||||
	website
 | 
			
		||||
	call
 | 
			
		||||
	email
 | 
			
		||||
	existing_customer
 | 
			
		||||
	partner
 | 
			
		||||
	public_relations
 | 
			
		||||
	campaign
 | 
			
		||||
	conference
 | 
			
		||||
	trade_show
 | 
			
		||||
	word_of_mouth
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Lead represents a potential customer in the CRM system
 | 
			
		||||
pub struct Lead {
 | 
			
		||||
	base.Base // Base struct for common fields (id u32, creation_time, mod_time)
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id                u32 // Removed, provided by base.Base
 | 
			
		||||
	contact_id        u32    // Reference to a Contact (holds name, email, phone etc.)
 | 
			
		||||
	description       string
 | 
			
		||||
	status            LeadStatus
 | 
			
		||||
	source            LeadSource
 | 
			
		||||
	opportunity_amount f64   // Optional: If lead is converted, this could be initial amount
 | 
			
		||||
	opportunity_name  string // Optional: If lead is converted, this could be initial name
 | 
			
		||||
	converted_at      ourtime.OurTime // Optional: Timestamp when lead was converted
 | 
			
		||||
	// created_at        ourtime.OurTime // Removed, provided by base.Base.creation_time
 | 
			
		||||
	// updated_at        ourtime.OurTime // Removed, provided by base.Base.mod_time
 | 
			
		||||
	assigned_user_id  u32    // Reference to User
 | 
			
		||||
	created_by_id     u32    // Reference to User
 | 
			
		||||
}
 | 
			
		||||
@@ -1,57 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// Opportunity represents a potential sale in the CRM system
 | 
			
		||||
pub struct Opportunity {
 | 
			
		||||
	base.Base // Base struct for common fields (id u32, creation_time, mod_time)
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id                u32 // Removed, provided by base.Base
 | 
			
		||||
	name              string
 | 
			
		||||
	account_id        u32    // Reference to Account
 | 
			
		||||
	amount            f64
 | 
			
		||||
	close_date        ourtime.OurTime // Expected close date
 | 
			
		||||
	probability       f64    // Percentage (0-100)
 | 
			
		||||
	stage             OpportunityStage
 | 
			
		||||
	source            OpportunitySource
 | 
			
		||||
	lead_source       string // More specific lead source details if needed
 | 
			
		||||
	campaign_id       u32    // Optional: Reference to Campaign
 | 
			
		||||
	description       string
 | 
			
		||||
	next_step         string // Optional
 | 
			
		||||
	competition       string // Optional
 | 
			
		||||
	// created_at        ourtime.OurTime // Removed, provided by base.Base.creation_time
 | 
			
		||||
	// updated_at        ourtime.OurTime // Removed, provided by base.Base.mod_time
 | 
			
		||||
	assigned_user_id  u32    // Reference to User
 | 
			
		||||
	created_by_id     u32    // Reference to User
 | 
			
		||||
	contacts          []u32  // References to Contacts associated with this opportunity
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OpportunityStage represents the stage of an opportunity
 | 
			
		||||
pub enum OpportunityStage {
 | 
			
		||||
	prospecting
 | 
			
		||||
	qualification
 | 
			
		||||
	needs_analysis
 | 
			
		||||
	value_proposition
 | 
			
		||||
	id_decision_makers
 | 
			
		||||
	perception_analysis
 | 
			
		||||
	proposal_price_quote
 | 
			
		||||
	negotiation_review
 | 
			
		||||
	closed_won
 | 
			
		||||
	closed_lost
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OpportunitySource represents the source of an opportunity
 | 
			
		||||
pub enum OpportunitySource {
 | 
			
		||||
	call
 | 
			
		||||
	email
 | 
			
		||||
	existing_customer
 | 
			
		||||
	partner
 | 
			
		||||
	public_relations
 | 
			
		||||
	campaign
 | 
			
		||||
	web_site
 | 
			
		||||
	conference
 | 
			
		||||
	trade_show
 | 
			
		||||
	word_of_mouth
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
@@ -1,43 +0,0 @@
 | 
			
		||||
module crm
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// TaskStatus represents the status of a task
 | 
			
		||||
pub enum TaskStatus {
 | 
			
		||||
	not_started
 | 
			
		||||
	in_progress
 | 
			
		||||
	completed
 | 
			
		||||
	deferred
 | 
			
		||||
	canceled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TaskPriority represents the priority of a task
 | 
			
		||||
pub enum TaskPriority {
 | 
			
		||||
	low
 | 
			
		||||
	medium
 | 
			
		||||
	high
 | 
			
		||||
	urgent
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Task represents a task or to-do item in the CRM system
 | 
			
		||||
pub struct Task {
 | 
			
		||||
	base.Base // Base struct for common fields (id u32, creation_time, mod_time)
 | 
			
		||||
pub mut:
 | 
			
		||||
	// id                u32 // Removed, provided by base.Base
 | 
			
		||||
	name              string
 | 
			
		||||
	status            TaskStatus
 | 
			
		||||
	priority          TaskPriority
 | 
			
		||||
	due_date          ourtime.OurTime // Optional
 | 
			
		||||
	completed_at      ourtime.OurTime // Optional
 | 
			
		||||
	description       string
 | 
			
		||||
	parent_type       string  // Optional: Can be 'Account', 'Contact', 'Lead', 'Opportunity', 'Case'
 | 
			
		||||
	parent_id         u32     // Optional: Reference to the parent entity
 | 
			
		||||
	account_id        u32     // Optional: Reference to Account
 | 
			
		||||
	contact_id        u32     // Optional: Reference to Contact
 | 
			
		||||
	reminder_time     ourtime.OurTime // Optional
 | 
			
		||||
	// created_at        ourtime.OurTime // Removed, provided by base.Base.creation_time
 | 
			
		||||
	// updated_at        ourtime.OurTime // Removed, provided by base.Base.mod_time
 | 
			
		||||
	assigned_user_id  u32     // Reference to User
 | 
			
		||||
	created_by_id     u32     // Reference to User
 | 
			
		||||
}
 | 
			
		||||
@@ -1,16 +1,27 @@
 | 
			
		||||
module finance
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Account represents a financial account for tracking balances and transactions
 | 
			
		||||
// Supports multiple account types (checking, savings, investment, etc.)
 | 
			
		||||
pub struct Account {
 | 
			
		||||
	base.Base
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string // internal name of the account for the user
 | 
			
		||||
	user_id     u32    // user id of the owner of the account
 | 
			
		||||
	description string // optional description of the account
 | 
			
		||||
	ledger      string // describes the ledger/blockchain where the account is located e.g. "ethereum", "bitcoin" or other institutions
 | 
			
		||||
	address     string // address of the account on the blockchain
 | 
			
		||||
	pubkey      string
 | 
			
		||||
	assets      []Asset
 | 
			
		||||
	name         string // User-friendly account name
 | 
			
		||||
	account_type AccountType
 | 
			
		||||
	balance      f64    // Current balance in the account's currency
 | 
			
		||||
	currency     string // Currency code (USD, EUR, etc.)
 | 
			
		||||
	description  string // Optional description of the account
 | 
			
		||||
	is_active    bool   // Whether the account is currently active
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountType defines the different types of financial accounts
 | 
			
		||||
pub enum AccountType {
 | 
			
		||||
	checking
 | 
			
		||||
	savings
 | 
			
		||||
	investment
 | 
			
		||||
	credit
 | 
			
		||||
	loan
 | 
			
		||||
	crypto
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,31 +1,34 @@
 | 
			
		||||
module finance
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
pub enum AssetType {
 | 
			
		||||
	erc20
 | 
			
		||||
	erc721
 | 
			
		||||
	erc1155
 | 
			
		||||
	native
 | 
			
		||||
}
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Asset represents any valuable resource owned by an entity
 | 
			
		||||
// Can be financial (stocks, bonds) or physical (real estate, commodities)
 | 
			
		||||
pub struct Asset {
 | 
			
		||||
	base.Base
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	amount      f64
 | 
			
		||||
	address     string    // address of the asset on the blockchain or bank
 | 
			
		||||
	asset_type  AssetType // type of the asset
 | 
			
		||||
	decimals    u8        // number of decimals of the asset
 | 
			
		||||
	name          string // Asset name or identifier
 | 
			
		||||
	symbol        string // Trading symbol or identifier @[index]
 | 
			
		||||
	asset_type    AssetType
 | 
			
		||||
	quantity      f64    // Amount of the asset held
 | 
			
		||||
	unit_price    f64    // Price per unit in the asset's currency
 | 
			
		||||
	total_value   f64    // total_value = quantity * unit_price
 | 
			
		||||
	currency      string // Currency for pricing (USD, EUR, etc.)
 | 
			
		||||
	category      string // Asset category (stocks, bonds, crypto, etc.)
 | 
			
		||||
	exchange      string // Exchange where asset is traded
 | 
			
		||||
	description   string // Detailed description of the asset
 | 
			
		||||
	is_active     bool   // Whether the asset is currently tracked
 | 
			
		||||
	purchase_date u64    // Unix timestamp of purchase/acquisition
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn (self Asset) index_keys() map[string]string {
 | 
			
		||||
	return {
 | 
			
		||||
		'name': self.name
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn (self Asset) ftindex_keys() map[string]string {
 | 
			
		||||
	return map[string]string{}
 | 
			
		||||
// AssetType defines the classification of assets
 | 
			
		||||
pub enum AssetType {
 | 
			
		||||
	stock
 | 
			
		||||
	bond
 | 
			
		||||
	crypto
 | 
			
		||||
	commodity
 | 
			
		||||
	real_estate
 | 
			
		||||
	currency
 | 
			
		||||
	nft
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,61 +1,29 @@
 | 
			
		||||
module marketplace
 | 
			
		||||
module finance
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import asset // For AssetType
 | 
			
		||||
// ListingStatus, ListingType enums and Bid struct are used from the same module
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Listing represents a marketplace listing for an asset
 | 
			
		||||
pub struct Listing {
 | 
			
		||||
	base.Base // Provides id, created_at, updated_at
 | 
			
		||||
// Marketplace represents a platform for buying and selling goods/services
 | 
			
		||||
// Can be internal or external marketplace configurations
 | 
			
		||||
pub struct Marketplace {
 | 
			
		||||
	core.Base
 | 
			
		||||
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
 | 
			
		||||
	name             string // Marketplace name (e.g., "Amazon", "eBay") @[index]
 | 
			
		||||
	marketplace_type MarketplaceType
 | 
			
		||||
	api_endpoint     string // API endpoint for marketplace integration
 | 
			
		||||
	api_key          string // Authentication key for API access
 | 
			
		||||
	currency         string // Default currency for transactions
 | 
			
		||||
	fee_percentage   f64    // Marketplace fee as percentage (0.0-100.0)
 | 
			
		||||
	is_active        bool   // Whether marketplace is currently enabled
 | 
			
		||||
	description      string // Detailed marketplace description
 | 
			
		||||
	support_email    string // Contact email for support issues
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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
 | 
			
		||||
// MarketplaceType defines the type of marketplace platform
 | 
			
		||||
pub enum MarketplaceType {
 | 
			
		||||
	centralized
 | 
			
		||||
	decentralized
 | 
			
		||||
	peer_to_peer
 | 
			
		||||
	auction
 | 
			
		||||
	exchange
 | 
			
		||||
	classified
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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
 | 
			
		||||
}
 | 
			
		||||
@@ -1,59 +0,0 @@
 | 
			
		||||
module flow
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
// enums from flow_enums.v and FlowStep from flow_step.v are used as they are in the same module
 | 
			
		||||
 | 
			
		||||
// Flow represents a complete workflow with multiple steps
 | 
			
		||||
pub struct Flow {
 | 
			
		||||
	base.Base // For common fields like id, created_at, updated_at
 | 
			
		||||
pub mut:
 | 
			
		||||
	name                string
 | 
			
		||||
	description         string
 | 
			
		||||
	flow_type           string
 | 
			
		||||
	status              FlowStatus
 | 
			
		||||
	current_step_id     string // Optional: Based on Option<FlowStep> in Rust, storing just ID
 | 
			
		||||
	progress_percentage u8
 | 
			
		||||
	owner_id            string
 | 
			
		||||
	owner_name          string
 | 
			
		||||
	data                string // Serialized JSON data (jsonb in Rust)
 | 
			
		||||
	steps               []FlowStep
 | 
			
		||||
	// current_step is not directly mapped, as it's derived. current_step_id can be used.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FlowStatus defines the overall status of a flow
 | 
			
		||||
pub enum FlowStatus {
 | 
			
		||||
	in_progress
 | 
			
		||||
	completed
 | 
			
		||||
	stuck
 | 
			
		||||
	cancelled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FlowStep represents an individual step within a larger flow
 | 
			
		||||
pub struct FlowStep {
 | 
			
		||||
pub mut:
 | 
			
		||||
	id           string // UUID, from Uuid::new_v4().to_string()
 | 
			
		||||
	name         string
 | 
			
		||||
	description  string
 | 
			
		||||
	status       StepStatus
 | 
			
		||||
	order        u32
 | 
			
		||||
	started_at   ourtime.OurTime // Optional: Option<DateTime<Utc>>
 | 
			
		||||
	completed_at ourtime.OurTime // Optional: Option<DateTime<Utc>>
 | 
			
		||||
	logs         []FlowLog
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// StepStatus defines the status of an individual step within a flow
 | 
			
		||||
pub enum StepStatus {
 | 
			
		||||
	pending
 | 
			
		||||
	in_progress
 | 
			
		||||
	completed
 | 
			
		||||
	stuck
 | 
			
		||||
	skipped
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FlowLog represents a log entry within a flow step
 | 
			
		||||
pub struct FlowLog {
 | 
			
		||||
pub mut:
 | 
			
		||||
	timestamp ourtime.OurTime
 | 
			
		||||
	message   string
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										24
									
								
								specs/models/gov/committee.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								specs/models/gov/committee.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// CommitteeMember represents a member of a committee
 | 
			
		||||
pub struct CommitteeMember {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	user_id     u32
 | 
			
		||||
	name        string
 | 
			
		||||
	role        CommitteeRole
 | 
			
		||||
	joined_date u64 // Unix timestamp
 | 
			
		||||
	notes       string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Committee represents a committee in the governance system
 | 
			
		||||
pub struct Committee {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id  u32    @[index]
 | 
			
		||||
	name        string @[index]
 | 
			
		||||
	description string
 | 
			
		||||
	members     []CommitteeMember
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								specs/models/gov/company.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								specs/models/gov/company.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// BusinessType represents the type of a business
 | 
			
		||||
pub struct BusinessType {
 | 
			
		||||
pub mut:
 | 
			
		||||
	type_name   string
 | 
			
		||||
	description string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Company represents a company in the governance system
 | 
			
		||||
pub struct Company {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name                string @[index]
 | 
			
		||||
	registration_number string @[index]
 | 
			
		||||
	incorporation_date  u64 // Unix timestamp
 | 
			
		||||
	fiscal_year_end     string
 | 
			
		||||
	email               string
 | 
			
		||||
	phone               string
 | 
			
		||||
	website             string
 | 
			
		||||
	address             string
 | 
			
		||||
	business_type       BusinessType
 | 
			
		||||
	industry            string
 | 
			
		||||
	description         string
 | 
			
		||||
	status              CompanyStatus
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								specs/models/gov/meeting.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								specs/models/gov/meeting.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Attendee represents an attendee of a meeting
 | 
			
		||||
pub struct Attendee {
 | 
			
		||||
pub mut:
 | 
			
		||||
	user_id u32
 | 
			
		||||
	name    string
 | 
			
		||||
	role    string
 | 
			
		||||
	status  AttendanceStatus
 | 
			
		||||
	notes   string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Meeting represents a meeting in the governance system
 | 
			
		||||
pub struct Meeting {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id   u32    @[index]
 | 
			
		||||
	title        string @[index]
 | 
			
		||||
	description  string
 | 
			
		||||
	meeting_type MeetingType
 | 
			
		||||
	status       MeetingStatus
 | 
			
		||||
	start_time   u64 // Unix timestamp
 | 
			
		||||
	end_time     u64 // Unix timestamp
 | 
			
		||||
	location     string
 | 
			
		||||
	agenda       string
 | 
			
		||||
	minutes      string
 | 
			
		||||
	attendees    []Attendee
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								specs/models/gov/resolution.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								specs/models/gov/resolution.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Resolution represents a resolution in the governance system
 | 
			
		||||
pub struct Resolution {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id      u32    @[index]
 | 
			
		||||
	title           string @[index]
 | 
			
		||||
	description     string
 | 
			
		||||
	resolution_type ResolutionType
 | 
			
		||||
	status          ResolutionStatus
 | 
			
		||||
	proposed_date   u64  // Unix timestamp
 | 
			
		||||
	effective_date  ?u64 // Unix timestamp
 | 
			
		||||
	expiry_date     ?u64 // Unix timestamp
 | 
			
		||||
	approvals       []string
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								specs/models/gov/shareholder.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								specs/models/gov/shareholder.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Shareholder represents a shareholder in the governance system
 | 
			
		||||
pub struct Shareholder {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id       u32    @[index]
 | 
			
		||||
	name             string @[index]
 | 
			
		||||
	shareholder_type ShareholderType
 | 
			
		||||
	contact_info     string @[index]
 | 
			
		||||
	shares           u32
 | 
			
		||||
	percentage       f64
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										82
									
								
								specs/models/gov/types.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								specs/models/gov/types.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
pub enum CompanyStatus {
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	dissolved
 | 
			
		||||
	suspended
 | 
			
		||||
	pending
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum ShareholderType {
 | 
			
		||||
	individual
 | 
			
		||||
	corporate
 | 
			
		||||
	trust
 | 
			
		||||
	partnership
 | 
			
		||||
	government
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum CommitteeRole {
 | 
			
		||||
	chair
 | 
			
		||||
	vice_chair
 | 
			
		||||
	secretary
 | 
			
		||||
	treasurer
 | 
			
		||||
	member
 | 
			
		||||
	observer
 | 
			
		||||
	advisor
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum MeetingStatus {
 | 
			
		||||
	scheduled
 | 
			
		||||
	in_progress
 | 
			
		||||
	completed
 | 
			
		||||
	cancelled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum MeetingType {
 | 
			
		||||
	board_meeting
 | 
			
		||||
	committee_meeting
 | 
			
		||||
	general_assembly
 | 
			
		||||
	annual_general_meeting
 | 
			
		||||
	extraordinary_general_meeting
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum AttendanceStatus {
 | 
			
		||||
	invited
 | 
			
		||||
	confirmed
 | 
			
		||||
	declined
 | 
			
		||||
	attended
 | 
			
		||||
	absent
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum ResolutionStatus {
 | 
			
		||||
	draft
 | 
			
		||||
	proposed
 | 
			
		||||
	approved
 | 
			
		||||
	rejected
 | 
			
		||||
	expired
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum ResolutionType {
 | 
			
		||||
	ordinary
 | 
			
		||||
	special
 | 
			
		||||
	unanimous
 | 
			
		||||
	written
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum VoteStatus {
 | 
			
		||||
	draft
 | 
			
		||||
	open
 | 
			
		||||
	closed
 | 
			
		||||
	cancelled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum VoteOption {
 | 
			
		||||
	yes
 | 
			
		||||
	no
 | 
			
		||||
	abstain
 | 
			
		||||
	custom
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								specs/models/gov/user.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								specs/models/gov/user.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// User represents a user in the governance system
 | 
			
		||||
pub struct User {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name  string @[index]
 | 
			
		||||
	email string @[index]
 | 
			
		||||
	role  string
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								specs/models/gov/vote.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								specs/models/gov/vote.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
module gov
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Ballot represents a ballot cast in a vote
 | 
			
		||||
pub struct Ballot {
 | 
			
		||||
pub mut:
 | 
			
		||||
	user_id u32
 | 
			
		||||
	option  VoteOption
 | 
			
		||||
	weight  f64
 | 
			
		||||
	cast_at u64 // Unix timestamp
 | 
			
		||||
	notes   string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Vote represents a vote in the governance system
 | 
			
		||||
pub struct Vote {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id    u32    @[index]
 | 
			
		||||
	resolution_id u32    @[index]
 | 
			
		||||
	title         string @[index]
 | 
			
		||||
	description   string
 | 
			
		||||
	status        VoteStatus
 | 
			
		||||
	start_date    u64 // Unix timestamp
 | 
			
		||||
	end_date      u64 // Unix timestamp
 | 
			
		||||
	ballots       []Ballot
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								specs/models/governance/activity.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								specs/models/governance/activity.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
pub struct GovernanceActivity {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id    u32    // Reference to company @[index]
 | 
			
		||||
	activity_type string // Type of activity (proposal, vote, meeting, etc.) @[index]
 | 
			
		||||
	description   string // Detailed description
 | 
			
		||||
	initiator_id  u32    // User who initiated @[index]
 | 
			
		||||
	target_id     u32    // Target entity ID
 | 
			
		||||
	target_type   string // Type of target (user, proposal, etc.)
 | 
			
		||||
	metadata      string // JSON metadata
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Activity types
 | 
			
		||||
pub enum ActivityType {
 | 
			
		||||
	proposal_created
 | 
			
		||||
	proposal_updated
 | 
			
		||||
	vote_cast
 | 
			
		||||
	meeting_scheduled
 | 
			
		||||
	resolution_passed
 | 
			
		||||
	shareholder_added
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								specs/models/governance/attached_file.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								specs/models/governance/attached_file.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// AttachedFile represents files attached to governance entities
 | 
			
		||||
pub struct AttachedFile {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	entity_id    u32    // ID of entity this file is attached to @[index]
 | 
			
		||||
	entity_type  string // Type of entity (proposal, meeting, etc.) @[index]
 | 
			
		||||
	filename     string // Original filename
 | 
			
		||||
	content_type string // MIME type
 | 
			
		||||
	size         u64    // File size in bytes
 | 
			
		||||
	path         string // Storage path
 | 
			
		||||
	description  string // Optional description
 | 
			
		||||
	uploaded_by  u32    // User who uploaded @[index]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										39
									
								
								specs/models/governance/committee.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								specs/models/governance/committee.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// CommitteeType defines committee categories
 | 
			
		||||
pub enum CommitteeType {
 | 
			
		||||
	board
 | 
			
		||||
	executive
 | 
			
		||||
	audit
 | 
			
		||||
	compensation
 | 
			
		||||
	nomination
 | 
			
		||||
	governance
 | 
			
		||||
	finance
 | 
			
		||||
	risk
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CommitteeStatus tracks committee state
 | 
			
		||||
pub enum CommitteeStatus {
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	dissolved
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Committee represents a governance committee
 | 
			
		||||
pub struct Committee {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id        u32             // Reference to company @[index]
 | 
			
		||||
	name              string          // Committee name @[index]
 | 
			
		||||
	committee_type    CommitteeType   // Type of committee
 | 
			
		||||
	description       string          // Detailed description
 | 
			
		||||
	status            CommitteeStatus // Current state
 | 
			
		||||
	chairman_id       u32             // Committee chair @[index]
 | 
			
		||||
	term_start        u64             // Start of term
 | 
			
		||||
	term_end          u64             // End of term
 | 
			
		||||
	meeting_frequency string          // e.g., "monthly", "quarterly"
 | 
			
		||||
	quorum_size       u32             // Minimum members for quorum
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										45
									
								
								specs/models/governance/company.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								specs/models/governance/company.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// CompanyType categorizes companies
 | 
			
		||||
pub enum CompanyType {
 | 
			
		||||
	corporation
 | 
			
		||||
	llc
 | 
			
		||||
	partnership
 | 
			
		||||
	cooperative
 | 
			
		||||
	nonprofit
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CompanyStatus tracks company state
 | 
			
		||||
pub enum CompanyStatus {
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	dissolved
 | 
			
		||||
	merged
 | 
			
		||||
	acquired
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Company represents a governance entity
 | 
			
		||||
pub struct Company {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name                string        // Company name @[index]
 | 
			
		||||
	legal_name          string        // Legal entity name @[index]
 | 
			
		||||
	company_type        CompanyType   // Type of company
 | 
			
		||||
	status              CompanyStatus // Current state
 | 
			
		||||
	incorporation_date  u64           // Unix timestamp
 | 
			
		||||
	jurisdiction        string        // Country/state of incorporation
 | 
			
		||||
	registration_number string        // Government registration @[index]
 | 
			
		||||
	tax_id              string        // Tax identification
 | 
			
		||||
	address             string        // Primary address
 | 
			
		||||
	headquarters        string        // City/country of HQ
 | 
			
		||||
	website             string        // Company website
 | 
			
		||||
	phone               string        // Contact phone
 | 
			
		||||
	email               string        // Contact email
 | 
			
		||||
	shares_authorized   u64           // Total authorized shares
 | 
			
		||||
	shares_issued       u64           // Currently issued shares
 | 
			
		||||
	par_value           f64           // Par value per share
 | 
			
		||||
	currency            string        // Currency code
 | 
			
		||||
	fiscal_year_end     string        // "MM-DD" format
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										44
									
								
								specs/models/governance/meeting.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								specs/models/governance/meeting.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// MeetingType defines meeting categories
 | 
			
		||||
pub enum MeetingType {
 | 
			
		||||
	annual_general
 | 
			
		||||
	extraordinary_general
 | 
			
		||||
	board
 | 
			
		||||
	committee
 | 
			
		||||
	special
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MeetingStatus tracks meeting state
 | 
			
		||||
pub enum MeetingStatus {
 | 
			
		||||
	scheduled
 | 
			
		||||
	in_progress
 | 
			
		||||
	completed
 | 
			
		||||
	cancelled
 | 
			
		||||
	postponed
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Meeting represents a governance meeting
 | 
			
		||||
pub struct Meeting {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id      u32           // Reference to company @[index]
 | 
			
		||||
	committee_id    u32           // Reference to committee @[index]
 | 
			
		||||
	meeting_type    MeetingType   // Type of meeting
 | 
			
		||||
	title           string        // Meeting title @[index]
 | 
			
		||||
	description     string        // Detailed description
 | 
			
		||||
	status          MeetingStatus // Current state
 | 
			
		||||
	scheduled_start u64           // Scheduled start time
 | 
			
		||||
	scheduled_end   u64           // Scheduled end time
 | 
			
		||||
	actual_start    u64           // Actual start time
 | 
			
		||||
	actual_end      u64           // Actual end time
 | 
			
		||||
	location        string        // Physical/virtual location
 | 
			
		||||
	meeting_url     string        // Video conference link
 | 
			
		||||
	agenda          string        // Meeting agenda
 | 
			
		||||
	minutes         string        // Meeting minutes
 | 
			
		||||
	quorum_required u32           // Members required for quorum
 | 
			
		||||
	quorum_present  bool          // Whether quorum was achieved
 | 
			
		||||
	created_by      u32           // User who scheduled @[index]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,62 +1,47 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
// ProposalStatus enum is used from governance_enums.v in the same module
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Proposal represents a governance proposal that can be voted upon.
 | 
			
		||||
// It now incorporates the voting mechanism from biz/vote.v.
 | 
			
		||||
pub struct Proposal {
 | 
			
		||||
	base.Base // Provides Proposal's own ID, created_at, updated_at
 | 
			
		||||
pub mut:
 | 
			
		||||
	// Fields from original Proposal struct
 | 
			
		||||
	creator_id       string // User ID of the proposal creator
 | 
			
		||||
	title            string // Title of the proposal
 | 
			
		||||
	description      string // Detailed description of the proposal
 | 
			
		||||
	status           ProposalStatus // Status of the proposal lifecycle (draft, active, approved etc.)
 | 
			
		||||
 | 
			
		||||
	// Fields from biz/vote.v's Vote struct (representing the voting event aspects of the proposal)
 | 
			
		||||
	vote_start_date    ourtime.OurTime // When voting on this proposal starts
 | 
			
		||||
	vote_end_date      ourtime.OurTime // When voting on this proposal ends
 | 
			
		||||
	vote_status        VoteEventStatus // Status of the voting event (open, closed, cancelled)
 | 
			
		||||
	options            []VoteOption    // The choices users can vote for
 | 
			
		||||
	ballots            []Ballot        // The cast votes by users
 | 
			
		||||
	private_group      []u32           // Optional: list of user IDs who are eligible to vote
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProposalStatus defines the lifecycle status of a governance proposal itself
 | 
			
		||||
// ProposalStatus tracks the state of a governance proposal
 | 
			
		||||
pub enum ProposalStatus {
 | 
			
		||||
	draft    // Proposal is being prepared
 | 
			
		||||
	active   // Proposal is active (might be pre-voting, during voting, or post-voting but not yet finalized)
 | 
			
		||||
	approved // Proposal has been formally approved
 | 
			
		||||
	rejected // Proposal has been formally rejected
 | 
			
		||||
	cancelled// Proposal was cancelled
 | 
			
		||||
	draft
 | 
			
		||||
	pending_review
 | 
			
		||||
	active
 | 
			
		||||
	voting
 | 
			
		||||
	passed
 | 
			
		||||
	rejected
 | 
			
		||||
	implemented
 | 
			
		||||
	cancelled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// -- Structures from biz/vote.v, adapted for integration --
 | 
			
		||||
 | 
			
		||||
// VoteEventStatus represents the status of the voting process for a proposal
 | 
			
		||||
// Renamed from VoteStatus in biz/vote.v to avoid confusion with ProposalStatus
 | 
			
		||||
pub enum VoteEventStatus {
 | 
			
		||||
	open      // Voting is currently open
 | 
			
		||||
	closed    // Voting has finished
 | 
			
		||||
	cancelled // The voting event was cancelled
 | 
			
		||||
// ProposalType categorizes proposals
 | 
			
		||||
pub enum ProposalType {
 | 
			
		||||
	constitutional
 | 
			
		||||
	policy
 | 
			
		||||
	budget
 | 
			
		||||
	election
 | 
			
		||||
	merger
 | 
			
		||||
	dissolution
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VoteOption represents a specific choice that can be voted on within a proposal's voting event
 | 
			
		||||
pub struct VoteOption {
 | 
			
		||||
// Proposal represents a governance proposal
 | 
			
		||||
pub struct Proposal {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	id        u8     // Simple identifier for this option within this proposal's vote (e.g., 1, 2, 3)
 | 
			
		||||
	text      string // The descriptive text of the option (e.g., "Option A: Approve budget")
 | 
			
		||||
	count     int    // How many votes this option has received
 | 
			
		||||
	min_valid int    // Optional: minimum votes needed for this option to be considered valid
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Ballot represents an individual vote cast by a user for a specific proposal
 | 
			
		||||
pub struct Ballot {
 | 
			
		||||
	base.Base // Provides Ballot's own ID, created_at, updated_at
 | 
			
		||||
pub mut:
 | 
			
		||||
	user_id        u32    // The ID of the user who cast this ballot
 | 
			
		||||
	vote_option_id u8     // The 'id' of the VoteOption chosen by the user
 | 
			
		||||
	shares_count   int    // Number of shares/tokens/voting power used for this ballot
 | 
			
		||||
	company_id           u32            // Reference to company @[index]
 | 
			
		||||
	title                string         // Proposal title @[index]
 | 
			
		||||
	description          string         // Detailed description
 | 
			
		||||
	proposal_type        ProposalType   // Category of proposal
 | 
			
		||||
	status               ProposalStatus // Current state
 | 
			
		||||
	proposer_id          u32            // User who created @[index]
 | 
			
		||||
	target_committee_id  u32            // Target committee @[index]
 | 
			
		||||
	voting_start         u64            // Start timestamp
 | 
			
		||||
	voting_end           u64            // End timestamp
 | 
			
		||||
	quorum_required      f64            // Percentage required
 | 
			
		||||
	approval_threshold   f64            // Percentage for approval
 | 
			
		||||
	votes_for            u32            // Votes in favor
 | 
			
		||||
	votes_against        u32            // Votes against
 | 
			
		||||
	votes_abstain        u32            // Abstention votes
 | 
			
		||||
	implementation_notes string         // Post-implementation notes
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										40
									
								
								specs/models/governance/resolution.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								specs/models/governance/resolution.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// ResolutionStatus tracks resolution state
 | 
			
		||||
pub enum ResolutionStatus {
 | 
			
		||||
	proposed
 | 
			
		||||
	voting
 | 
			
		||||
	passed
 | 
			
		||||
	failed
 | 
			
		||||
	implemented
 | 
			
		||||
	withdrawn
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ResolutionType categorizes resolutions
 | 
			
		||||
pub enum ResolutionType {
 | 
			
		||||
	ordinary
 | 
			
		||||
	special
 | 
			
		||||
	unanimous
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Resolution represents a formal resolution
 | 
			
		||||
pub struct Resolution {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	company_id        u32              // Reference to company @[index]
 | 
			
		||||
	meeting_id        u32              // Reference to meeting @[index]
 | 
			
		||||
	proposal_id       u32              // Reference to proposal @[index]
 | 
			
		||||
	resolution_number string           // Unique resolution number @[index]
 | 
			
		||||
	title             string           // Resolution title @[index]
 | 
			
		||||
	description       string           // Detailed description
 | 
			
		||||
	resolution_type   ResolutionType   // Category
 | 
			
		||||
	status            ResolutionStatus // Current state
 | 
			
		||||
	mover_id          u32              // Person who moved @[index]
 | 
			
		||||
	seconder_id       u32              // Person who seconded @[index]
 | 
			
		||||
	votes_for         u32              // Votes in favor
 | 
			
		||||
	votes_against     u32              // Votes against
 | 
			
		||||
	votes_abstain     u32              // Abstention votes
 | 
			
		||||
	effective_date    u64              // When resolution takes effect
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										48
									
								
								specs/models/governance/user.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								specs/models/governance/user.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// UserType defines user categories
 | 
			
		||||
pub enum UserType {
 | 
			
		||||
	individual
 | 
			
		||||
	corporate
 | 
			
		||||
	system
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UserStatus tracks user state
 | 
			
		||||
pub enum UserStatus {
 | 
			
		||||
	active
 | 
			
		||||
	inactive
 | 
			
		||||
	suspended
 | 
			
		||||
	pending
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UserRole defines governance roles
 | 
			
		||||
pub enum UserRole {
 | 
			
		||||
	shareholder
 | 
			
		||||
	director
 | 
			
		||||
	officer
 | 
			
		||||
	employee
 | 
			
		||||
	auditor
 | 
			
		||||
	consultant
 | 
			
		||||
	administrator
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// User represents a governance participant
 | 
			
		||||
pub struct User {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	username        string     // Unique username @[index]
 | 
			
		||||
	email           string     // Email address @[index]
 | 
			
		||||
	first_name      string     // First name
 | 
			
		||||
	last_name       string     // Last name
 | 
			
		||||
	display_name    string     // Preferred display name
 | 
			
		||||
	user_type       UserType   // Type of user
 | 
			
		||||
	status          UserStatus // Current state
 | 
			
		||||
	roles           []UserRole // Governance roles
 | 
			
		||||
	company_id      u32        // Primary company @[index]
 | 
			
		||||
	phone           string     // Contact phone
 | 
			
		||||
	address         string     // Contact address
 | 
			
		||||
	profile_picture string     // Profile picture URL
 | 
			
		||||
	last_login      u64        // Last login timestamp
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										34
									
								
								specs/models/governance/vote.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								specs/models/governance/vote.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
module governance
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// VoteValue represents voting choices
 | 
			
		||||
pub enum VoteValue {
 | 
			
		||||
	yes
 | 
			
		||||
	no
 | 
			
		||||
	abstain
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VoteStatus tracks vote state
 | 
			
		||||
pub enum VoteStatus {
 | 
			
		||||
	pending
 | 
			
		||||
	cast
 | 
			
		||||
	changed
 | 
			
		||||
	retracted
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Vote represents a governance vote
 | 
			
		||||
pub struct Vote {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	proposal_id    u32        // Reference to proposal @[index]
 | 
			
		||||
	resolution_id  u32        // Reference to resolution @[index]
 | 
			
		||||
	voter_id       u32        // User who voted @[index]
 | 
			
		||||
	company_id     u32        // Reference to company @[index]
 | 
			
		||||
	vote_value     VoteValue  // Voting choice
 | 
			
		||||
	status         VoteStatus // Current state
 | 
			
		||||
	weight         u32        // Vote weight (for weighted voting)
 | 
			
		||||
	comments       string     // Optional comments
 | 
			
		||||
	proxy_voter_id u32        // If voting by proxy @[index]
 | 
			
		||||
	ip_address     string     // IP address for verification
 | 
			
		||||
}
 | 
			
		||||
@@ -1,68 +1,55 @@
 | 
			
		||||
module contract
 | 
			
		||||
module legal
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Contract represents a legal agreement
 | 
			
		||||
pub struct Contract {
 | 
			
		||||
	base.Base // Base struct for common fields
 | 
			
		||||
pub mut:
 | 
			
		||||
	id                      string // Unique ID for the contract (UUID string)
 | 
			
		||||
	title                   string
 | 
			
		||||
	description             string
 | 
			
		||||
	contract_type           string // service, employment, nda, sla, partnership, distribution, license, membership, other
 | 
			
		||||
	status                  ContractStatus
 | 
			
		||||
	created_at              ourtime.OurTime
 | 
			
		||||
	updated_at              ourtime.OurTime
 | 
			
		||||
	created_by              string          // User ID or name of the creator
 | 
			
		||||
	terms_and_conditions    string          // JSON string or markdown
 | 
			
		||||
	start_date              ourtime.OurTime // Optional
 | 
			
		||||
	end_date                ourtime.OurTime // Optional
 | 
			
		||||
	renewal_period_days     int             // Optional (0 if not applicable)
 | 
			
		||||
	next_renewal_date       ourtime.OurTime // Optional
 | 
			
		||||
	signers                 []ContractSigner
 | 
			
		||||
	revisions               []ContractRevision
 | 
			
		||||
	current_version         u32
 | 
			
		||||
	last_signed_date        ourtime.OurTime // Optional
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContractRevision represents a version of the contract content
 | 
			
		||||
pub struct ContractRevision {
 | 
			
		||||
	// base.Base // If applicable
 | 
			
		||||
pub mut:
 | 
			
		||||
	version    u32
 | 
			
		||||
	content    string // The actual content of the contract revision
 | 
			
		||||
	created_at ourtime.OurTime
 | 
			
		||||
	created_by string // User ID or name of the creator
 | 
			
		||||
	comments   string // Optional in Rust, string can be empty
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContractStatus defines the possible statuses of a contract
 | 
			
		||||
// ContractStatus represents the current state of a legal contract
 | 
			
		||||
pub enum ContractStatus {
 | 
			
		||||
	draft
 | 
			
		||||
	pending_signatures
 | 
			
		||||
	signed
 | 
			
		||||
	pending
 | 
			
		||||
	active
 | 
			
		||||
	expired
 | 
			
		||||
	terminated
 | 
			
		||||
	cancelled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContractSigner represents a party involved in signing a contract
 | 
			
		||||
pub struct ContractSigner {
 | 
			
		||||
pub mut:
 | 
			
		||||
	id         string // Unique ID for the signer (UUID string)
 | 
			
		||||
	name       string
 | 
			
		||||
	email      string
 | 
			
		||||
	status     SignerStatus
 | 
			
		||||
	signed_at  ourtime.OurTime // Optional in Rust, OurTime can be zero
 | 
			
		||||
	comments   string        // Optional in Rust, string can be empty
 | 
			
		||||
	last_reminder_mail_sent_at ourtime.OurTime // Unix timestamp of last reminder sent
 | 
			
		||||
	signature_data string    // Base64 encoded signature image data (Optional in Rust)
 | 
			
		||||
// ContractType categorizes the type of legal agreement
 | 
			
		||||
pub enum ContractType {
 | 
			
		||||
	service
 | 
			
		||||
	sales
 | 
			
		||||
	lease
 | 
			
		||||
	employment
 | 
			
		||||
	partnership
 | 
			
		||||
	nda
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SignerStatus defines the status of a contract signer
 | 
			
		||||
pub enum SignerStatus {
 | 
			
		||||
	pending
 | 
			
		||||
	signed
 | 
			
		||||
	rejected
 | 
			
		||||
// Contract represents a legal agreement between parties
 | 
			
		||||
// This model stores essential information about contracts including parties, terms, and status
 | 
			
		||||
pub struct Contract {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	title          string         // Human-readable title of the contract @[index]
 | 
			
		||||
	contract_type  ContractType   // Type/category of the contract
 | 
			
		||||
	status         ContractStatus // Current status of the contract
 | 
			
		||||
	party_a        string         // First party identifier (company, individual, etc.) @[index]
 | 
			
		||||
	party_b        string         // Second party identifier @[index]
 | 
			
		||||
	effective_date u64            // Unix timestamp when contract becomes effective
 | 
			
		||||
 | 
			
		||||
	expiration_date u64 // Unix timestamp when contract expires
 | 
			
		||||
 | 
			
		||||
	total_value f64 // Monetary value of the contract
 | 
			
		||||
 | 
			
		||||
	currency string // Currency code (USD, EUR, etc.)
 | 
			
		||||
 | 
			
		||||
	terms string // Full text of the contract terms
 | 
			
		||||
 | 
			
		||||
	signature_date u64 // Unix timestamp when contract was signed
 | 
			
		||||
 | 
			
		||||
	version string // Version identifier for contract revisions
 | 
			
		||||
 | 
			
		||||
	parent_contract_id ?u32 // Optional reference to parent contract for amendments @[index]
 | 
			
		||||
 | 
			
		||||
	attachment_urls []string // URLs or paths to attached documents
 | 
			
		||||
 | 
			
		||||
	notes string // Additional notes and comments
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								specs/models/library/book.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								specs/models/library/book.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
module library
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// TocEntry represents a table of contents entry for a book
 | 
			
		||||
pub struct TocEntry {
 | 
			
		||||
	// Title of the chapter/section
 | 
			
		||||
	title string
 | 
			
		||||
 | 
			
		||||
	// Page number (index in the pages array)
 | 
			
		||||
	page u32
 | 
			
		||||
 | 
			
		||||
	// Optional subsections
 | 
			
		||||
	subsections []TocEntry
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Book represents a Book library item (collection of markdown pages with TOC)
 | 
			
		||||
pub struct Book {
 | 
			
		||||
	core.Base // Title of the book
 | 
			
		||||
	title string @[index]
 | 
			
		||||
 | 
			
		||||
	// Optional description of the book
 | 
			
		||||
	description ?string
 | 
			
		||||
 | 
			
		||||
	// Table of contents
 | 
			
		||||
	table_of_contents []TocEntry
 | 
			
		||||
 | 
			
		||||
	// Pages content (markdown strings)
 | 
			
		||||
	pages []string
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								specs/models/library/collection.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								specs/models/library/collection.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
module library
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Collection represents a collection of library items
 | 
			
		||||
pub struct Collection {
 | 
			
		||||
	core.Base // Title of the collection
 | 
			
		||||
	title string @[index]
 | 
			
		||||
 | 
			
		||||
	// Optional description of the collection
 | 
			
		||||
	description ?string
 | 
			
		||||
 | 
			
		||||
	// List of image item IDs belonging to this collection
 | 
			
		||||
	images []u32
 | 
			
		||||
 | 
			
		||||
	// List of PDF item IDs belonging to this collection
 | 
			
		||||
	pdfs []u32
 | 
			
		||||
 | 
			
		||||
	// List of Markdown item IDs belonging to this collection
 | 
			
		||||
	markdowns []u32
 | 
			
		||||
 | 
			
		||||
	// List of Book item IDs belonging to this collection
 | 
			
		||||
	books []u32
 | 
			
		||||
 | 
			
		||||
	// List of Slides item IDs belonging to this collection
 | 
			
		||||
	slides []u32
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								specs/models/library/image.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								specs/models/library/image.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
module library
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Image represents an Image library item
 | 
			
		||||
pub struct Image {
 | 
			
		||||
	core.Base // Title of the image
 | 
			
		||||
	title string @[index]
 | 
			
		||||
 | 
			
		||||
	// Optional description of the image
 | 
			
		||||
	description ?string
 | 
			
		||||
 | 
			
		||||
	// URL of the image
 | 
			
		||||
	url string
 | 
			
		||||
 | 
			
		||||
	// Width of the image in pixels
 | 
			
		||||
	width u32
 | 
			
		||||
 | 
			
		||||
	// Height of the image in pixels
 | 
			
		||||
	height u32
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								specs/models/library/markdown.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								specs/models/library/markdown.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
module library
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Markdown represents a Markdown document library item
 | 
			
		||||
pub struct Markdown {
 | 
			
		||||
	core.Base // Title of the document
 | 
			
		||||
	title string @[index]
 | 
			
		||||
 | 
			
		||||
	// Optional description of the document
 | 
			
		||||
	description ?string
 | 
			
		||||
 | 
			
		||||
	// The markdown content
 | 
			
		||||
	content string
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								specs/models/library/pdf.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								specs/models/library/pdf.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
module library
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Pdf represents a PDF document library item
 | 
			
		||||
pub struct Pdf {
 | 
			
		||||
	core.Base // Title of the PDF
 | 
			
		||||
	title string @[index]
 | 
			
		||||
 | 
			
		||||
	// Optional description of the PDF
 | 
			
		||||
	description ?string
 | 
			
		||||
 | 
			
		||||
	// URL of the PDF file
 | 
			
		||||
	url string
 | 
			
		||||
 | 
			
		||||
	// Number of pages in the PDF
 | 
			
		||||
	page_count u32
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								specs/models/library/slideshow.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								specs/models/library/slideshow.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
module library
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Slide represents a single slide in a slideshow
 | 
			
		||||
pub struct Slide {
 | 
			
		||||
	// URL of the image for this slide
 | 
			
		||||
	image_url string
 | 
			
		||||
 | 
			
		||||
	// Optional title for the slide
 | 
			
		||||
	title ?string
 | 
			
		||||
 | 
			
		||||
	// Optional description for the slide
 | 
			
		||||
	description ?string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Slideshow represents a Slideshow library item (collection of images for slideshow)
 | 
			
		||||
pub struct Slideshow {
 | 
			
		||||
	core.Base // Title of the slideshow
 | 
			
		||||
	title string @[index]
 | 
			
		||||
 | 
			
		||||
	// Optional description of the slideshow
 | 
			
		||||
	description ?string
 | 
			
		||||
 | 
			
		||||
	// List of slides
 | 
			
		||||
	slides []Slide
 | 
			
		||||
}
 | 
			
		||||
@@ -1,284 +0,0 @@
 | 
			
		||||
# MCC (Mail, Calendar, Contacts) Specification
 | 
			
		||||
 | 
			
		||||
This document outlines the data models for the MCC system, which is designed to be a self-hosted alternative to Google's Mail, Calendar, and Contacts services with full control over data.
 | 
			
		||||
 | 
			
		||||
## Overview
 | 
			
		||||
 | 
			
		||||
The MCC system consists of three main components:
 | 
			
		||||
 | 
			
		||||
1. **Mail**: A messaging system that can be used for email as well as chat
 | 
			
		||||
2. **Calendar**: A calendar system for managing events and appointments
 | 
			
		||||
3. **Contacts**: A contact management system
 | 
			
		||||
 | 
			
		||||
All components are integrated with the `circle.User` model, which serves as the primary user model for the system.
 | 
			
		||||
 | 
			
		||||
## Data Models
 | 
			
		||||
 | 
			
		||||
### User Model
 | 
			
		||||
 | 
			
		||||
The user model is defined in `circle/user.v` and has been enhanced with additional fields for MCC functionality:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// User represents a member of a circle
 | 
			
		||||
pub struct User {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name        string // name of the member as used in this circle
 | 
			
		||||
    description string // optional description which is relevant to this circle
 | 
			
		||||
    role        Role   // role of the member in the circle
 | 
			
		||||
    contact_ids []u32  // IDs of contacts linked to this member
 | 
			
		||||
    wallet_ids  []u32  // IDs of wallets owned by this member which are relevant to this circle
 | 
			
		||||
    pubkey      string // public key of the member as used in this circle
 | 
			
		||||
    
 | 
			
		||||
    // Additional fields needed for MCC functionality
 | 
			
		||||
    email       string // Primary email address
 | 
			
		||||
    timezone    string // User's preferred timezone
 | 
			
		||||
    preferences UserPreferences // User preferences for MCC
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UserPreferences represents user preferences for MCC
 | 
			
		||||
pub struct UserPreferences {
 | 
			
		||||
pub mut:
 | 
			
		||||
    default_calendar_id u32    // Default calendar ID
 | 
			
		||||
    default_view        string // Default view (day, week, month)
 | 
			
		||||
    email_signature     string // Default email signature
 | 
			
		||||
    theme               string // UI theme preference
 | 
			
		||||
    notifications       bool   // Enable/disable notifications
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Mail Models
 | 
			
		||||
 | 
			
		||||
The mail models are defined in `mcc/message.v`:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// Message represents an email message
 | 
			
		||||
pub struct Message {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    id             u32          // Database ID
 | 
			
		||||
    message_id     string       // Unique identifier for the email
 | 
			
		||||
    conversation_id string       // ID for grouping messages in the same thread
 | 
			
		||||
    folder         string       // The folder this email belongs to (inbox, sent, drafts, etc.)
 | 
			
		||||
    labels         []string     // Google-style labels for organization
 | 
			
		||||
    message        string       // The email body content
 | 
			
		||||
    attachments    []Attachment // Any file attachments
 | 
			
		||||
    send_time      ourtime.OurTime
 | 
			
		||||
    
 | 
			
		||||
    date     i64    // Unix timestamp when the email was sent/received
 | 
			
		||||
    size     u32    // Size of the message in bytes
 | 
			
		||||
    read     bool   // Whether the email has been read
 | 
			
		||||
    flagged  bool   // Whether the email has been flagged/starred
 | 
			
		||||
    priority string // Priority level (high, normal, low)
 | 
			
		||||
    
 | 
			
		||||
    // Header information
 | 
			
		||||
    subject     string
 | 
			
		||||
    from        []u32 // List of user IDs who sent the email
 | 
			
		||||
    sender      []u32
 | 
			
		||||
    reply_to    []u32
 | 
			
		||||
    to          []u32
 | 
			
		||||
    cc          []u32
 | 
			
		||||
    bcc         []u32
 | 
			
		||||
    in_reply_to u32
 | 
			
		||||
    
 | 
			
		||||
    // Additional fields
 | 
			
		||||
    draft          bool           // Whether this is a draft message
 | 
			
		||||
    scheduled_send ourtime.OurTime // Time to send if scheduled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attachment represents an email attachment
 | 
			
		||||
pub struct Attachment {
 | 
			
		||||
pub mut:
 | 
			
		||||
    filename     string
 | 
			
		||||
    content_type string
 | 
			
		||||
    hash         string // Hash of the attachment data
 | 
			
		||||
    size         u32    // Size in bytes
 | 
			
		||||
    content      []byte // Optional, for storing small attachments directly
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Calendar Models
 | 
			
		||||
 | 
			
		||||
The calendar models are defined in `mcc/calendar.v`:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// Calendar represents a collection of events
 | 
			
		||||
pub struct Calendar {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name        string // Name of the calendar
 | 
			
		||||
    description string // Description of the calendar
 | 
			
		||||
    color       string // Color for the calendar
 | 
			
		||||
    owner_id    u32    // User who owns this calendar
 | 
			
		||||
    timezone    string // Default timezone for this calendar
 | 
			
		||||
    visibility  string // Public, private, etc.
 | 
			
		||||
    shared_with []CalendarShare // Users this calendar is shared with
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarShare represents calendar sharing permissions
 | 
			
		||||
pub struct CalendarShare {
 | 
			
		||||
pub mut:
 | 
			
		||||
    user_id    u32    // User ID this calendar is shared with
 | 
			
		||||
    permission string // Read, write, owner, etc.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarEvent represents a calendar event with all its properties
 | 
			
		||||
pub struct CalendarEvent {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    calendar_id u32    // ID of the calendar this event belongs to
 | 
			
		||||
    title       string // Event title
 | 
			
		||||
    description string // Event details
 | 
			
		||||
    location    string // Event location
 | 
			
		||||
    start_time  ourtime.OurTime
 | 
			
		||||
    end_time    ourtime.OurTime   // End time
 | 
			
		||||
    all_day     bool              // True if it's an all-day event
 | 
			
		||||
    recurrence  string            // RFC 5545 Recurrence Rule (e.g., "FREQ=DAILY;COUNT=10")
 | 
			
		||||
    attendees   []Attendee        // List of attendees
 | 
			
		||||
    organizer   u32               // The user who created the event
 | 
			
		||||
    status      string            // "CONFIRMED", "CANCELLED", "TENTATIVE"
 | 
			
		||||
    color       string            // User-friendly color categorization
 | 
			
		||||
    reminders   []Reminder        // Reminders for this event
 | 
			
		||||
    timezone    string            // Timezone for this specific event
 | 
			
		||||
    visibility  string            // Public, private, etc.
 | 
			
		||||
    attachments []Attachment      // Attachments for this event
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reminder represents a reminder for an event
 | 
			
		||||
pub struct Reminder {
 | 
			
		||||
pub mut:
 | 
			
		||||
    event_id u32 // Event this reminder is for
 | 
			
		||||
    time     ourtime.OurTime // When to send the reminder
 | 
			
		||||
    method   string // How to deliver the reminder (email, notification, etc.)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attendee represents an attendee of an event
 | 
			
		||||
pub struct Attendee {
 | 
			
		||||
pub mut:
 | 
			
		||||
    user_id   u32    // User ID of the attendee
 | 
			
		||||
    email     string // Email of the attendee (for external attendees)
 | 
			
		||||
    name      string // Name of the attendee
 | 
			
		||||
    response  string // "ACCEPTED", "DECLINED", "TENTATIVE", "NEEDS-ACTION"
 | 
			
		||||
    optional  bool   // Whether attendance is optional
 | 
			
		||||
    comment   string // Attendee's comment
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Contacts Models
 | 
			
		||||
 | 
			
		||||
The contacts models are defined in `mcc/contacts.v`:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// Contact represents a contact with all their information
 | 
			
		||||
pub struct Contact {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name           string // Display name of the contact
 | 
			
		||||
    first_name     string
 | 
			
		||||
    last_name      string
 | 
			
		||||
    nickname       string
 | 
			
		||||
    email          []ContactEmail // Multiple email addresses with labels
 | 
			
		||||
    phone          []ContactPhone // Multiple phone numbers with labels
 | 
			
		||||
    address        []ContactAddress // Multiple addresses with labels
 | 
			
		||||
    company        string
 | 
			
		||||
    job_title      string
 | 
			
		||||
    notes          string
 | 
			
		||||
    birthday       ourtime.OurTime
 | 
			
		||||
    website        []string
 | 
			
		||||
    social_profiles []SocialProfile
 | 
			
		||||
    photo          string // Path or URL to contact photo
 | 
			
		||||
    groups         []u32  // IDs of groups this contact belongs to
 | 
			
		||||
    custom_fields  []CustomField // User-defined fields
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactEmail represents an email address with a label
 | 
			
		||||
pub struct ContactEmail {
 | 
			
		||||
pub mut:
 | 
			
		||||
    email   string
 | 
			
		||||
    label   string // Home, Work, Other, etc.
 | 
			
		||||
    primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactPhone represents a phone number with a label
 | 
			
		||||
pub struct ContactPhone {
 | 
			
		||||
pub mut:
 | 
			
		||||
    number  string
 | 
			
		||||
    label   string // Mobile, Home, Work, etc.
 | 
			
		||||
    primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactAddress represents a physical address with a label
 | 
			
		||||
pub struct ContactAddress {
 | 
			
		||||
pub mut:
 | 
			
		||||
    street      string
 | 
			
		||||
    city        string
 | 
			
		||||
    state       string
 | 
			
		||||
    postal_code string
 | 
			
		||||
    country     string
 | 
			
		||||
    label       string // Home, Work, Other, etc.
 | 
			
		||||
    primary     bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SocialProfile represents a social media profile
 | 
			
		||||
pub struct SocialProfile {
 | 
			
		||||
pub mut:
 | 
			
		||||
    platform string // Facebook, Twitter, LinkedIn, etc.
 | 
			
		||||
    username string
 | 
			
		||||
    url      string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CustomField represents a user-defined field
 | 
			
		||||
pub struct CustomField {
 | 
			
		||||
pub mut:
 | 
			
		||||
    label string
 | 
			
		||||
    value string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactGroup represents a group of contacts
 | 
			
		||||
pub struct ContactGroup {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name        string
 | 
			
		||||
    description string
 | 
			
		||||
    contacts    []u32 // IDs of contacts in this group
 | 
			
		||||
    owner_id    u32   // User who owns this group
 | 
			
		||||
    shared_with []u32 // Users this group is shared with
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Integration Points
 | 
			
		||||
 | 
			
		||||
The MCC system integrates with the existing system in the following ways:
 | 
			
		||||
 | 
			
		||||
1. **User Integration**:
 | 
			
		||||
   - Uses `circle.User` as the primary user model
 | 
			
		||||
   - The `biz.User` model has been deprecated and should not be used
 | 
			
		||||
 | 
			
		||||
2. **Cross-Component Integration**:
 | 
			
		||||
   - Calendar events can reference contacts as attendees
 | 
			
		||||
   - Emails can reference calendar events (for invitations)
 | 
			
		||||
   - Contacts can be used in email addressing
 | 
			
		||||
 | 
			
		||||
3. **Base Integration**:
 | 
			
		||||
   - All models extend the `base.Base` struct for common fields
 | 
			
		||||
   - Consistent ID and timestamp handling
 | 
			
		||||
 | 
			
		||||
## System Architecture
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
|  Mail System   |<----->|  User System   |<----->| Contact System |
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
        ^                        ^                        ^
 | 
			
		||||
        |                        |                        |
 | 
			
		||||
        v                        v                        v
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
| Calendar System|<----->|  Base System   |<----->|  Group System  |
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
This specification provides a comprehensive data model for creating a self-hosted alternative to Google's Mail, Calendar, and Contacts services, with a focus on data ownership and control.
 | 
			
		||||
@@ -1,93 +0,0 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// EventStatus represents the status of a calendar event
 | 
			
		||||
pub enum EventStatus {
 | 
			
		||||
	confirmed
 | 
			
		||||
	cancelled
 | 
			
		||||
	tentative
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EventVisibility represents the visibility setting of a calendar event
 | 
			
		||||
pub enum EventVisibility {
 | 
			
		||||
	public
 | 
			
		||||
	private
 | 
			
		||||
	confidential
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AttendeeResponse represents an attendee's response to an event invitation
 | 
			
		||||
pub enum AttendeeResponse {
 | 
			
		||||
	accepted
 | 
			
		||||
	declined
 | 
			
		||||
	tentative
 | 
			
		||||
	needs_action
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Calendar represents a collection of events
 | 
			
		||||
pub struct Calendar {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string // Name of the calendar
 | 
			
		||||
	description string // Description of the calendar
 | 
			
		||||
	color       string // Color for the calendar
 | 
			
		||||
	owner_id    u32    // User who owns this calendar
 | 
			
		||||
	timezone    string // Default timezone for this calendar
 | 
			
		||||
	visibility  string // Public, private, etc.
 | 
			
		||||
	shared_with []CalendarShare // Users this calendar is shared with
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarShare represents calendar sharing permissions
 | 
			
		||||
pub struct CalendarShare {
 | 
			
		||||
pub mut:
 | 
			
		||||
	user_id    u32    // User ID this calendar is shared with
 | 
			
		||||
	permission string // Read, write, owner, etc.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarEvent represents a calendar event with all its properties
 | 
			
		||||
pub struct CalendarEvent {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	calendar_id u32    // ID of the calendar this event belongs to
 | 
			
		||||
	title       string // Event title
 | 
			
		||||
	description string // Event details
 | 
			
		||||
	location    string // Event location
 | 
			
		||||
	start_time  ourtime.OurTime
 | 
			
		||||
	end_time    ourtime.OurTime   // End time
 | 
			
		||||
	all_day     bool              // True if it's an all-day event
 | 
			
		||||
	recurrence  string            // RFC 5545 Recurrence Rule (e.g., "FREQ=DAILY;COUNT=10")
 | 
			
		||||
	attendees   []Attendee        // List of attendees
 | 
			
		||||
	organizer   u32               // The user (see circle) who created the event
 | 
			
		||||
	status      EventStatus       // Status of the event
 | 
			
		||||
	reminders   []Reminder        // Reminders for this event
 | 
			
		||||
	timezone    string            // Timezone for this specific event
 | 
			
		||||
	visibility  EventVisibility   // Visibility setting for the event
 | 
			
		||||
	attachments []Attachment      // Attachments for this event
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reminder represents a reminder for an event
 | 
			
		||||
pub struct Reminder {
 | 
			
		||||
pub mut:
 | 
			
		||||
	event_id u32 // Event this reminder is for
 | 
			
		||||
	time     ourtime.OurTime // When to send the reminder
 | 
			
		||||
	method   string // How to deliver the reminder (email, notification, etc.)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attendee represents an attendee of an event
 | 
			
		||||
pub struct Attendee {
 | 
			
		||||
pub mut:
 | 
			
		||||
	contact_id   u32    // User ID of the attendee
 | 
			
		||||
	response  AttendeeResponse // Attendee's response to the event invitation
 | 
			
		||||
	optional  bool   // Whether attendance is optional
 | 
			
		||||
	comment   string // Attendee's comment
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attachment represents an attachment for a calendar event
 | 
			
		||||
pub struct Attachment {
 | 
			
		||||
pub mut:
 | 
			
		||||
	filename     string
 | 
			
		||||
	content_type string
 | 
			
		||||
	hash         string // Hash of the attachment data
 | 
			
		||||
	size         u32    // Size in bytes
 | 
			
		||||
}
 | 
			
		||||
@@ -1,111 +0,0 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// ContactLabelType represents the type of label for contact information
 | 
			
		||||
pub enum ContactLabelType {
 | 
			
		||||
	home
 | 
			
		||||
	work
 | 
			
		||||
	mobile
 | 
			
		||||
	other
 | 
			
		||||
	main
 | 
			
		||||
	personal
 | 
			
		||||
	business
 | 
			
		||||
	school
 | 
			
		||||
	custom // For user-defined labels
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SocialPlatformType represents the type of social media platform
 | 
			
		||||
pub enum SocialPlatformType {
 | 
			
		||||
	facebook
 | 
			
		||||
	twitter
 | 
			
		||||
	linkedin
 | 
			
		||||
	instagram
 | 
			
		||||
	github
 | 
			
		||||
	youtube
 | 
			
		||||
	tiktok
 | 
			
		||||
	reddit
 | 
			
		||||
	pinterest
 | 
			
		||||
	snapchat
 | 
			
		||||
	whatsapp
 | 
			
		||||
	telegram
 | 
			
		||||
	discord
 | 
			
		||||
	mastodon
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Contact represents a contact with all their information
 | 
			
		||||
pub struct Contact {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	name           string // Display name of the contact
 | 
			
		||||
	first_name     string
 | 
			
		||||
	last_name      string
 | 
			
		||||
	nickname       string
 | 
			
		||||
	email          []ContactEmail // Multiple email addresses with labels
 | 
			
		||||
	phone          []ContactPhone // Multiple phone numbers with labels
 | 
			
		||||
	address        []ContactAddress // Multiple addresses with labels
 | 
			
		||||
	company        string
 | 
			
		||||
	job_title      string
 | 
			
		||||
	notes          string
 | 
			
		||||
	birthday       ourtime.OurTime
 | 
			
		||||
	website        []string
 | 
			
		||||
	social_profiles []SocialProfile
 | 
			
		||||
	photo          u32 // link to the attachment in the circle
 | 
			
		||||
	custom_fields  []CustomField // User-defined fields
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactEmail represents an email address with a label
 | 
			
		||||
pub struct ContactEmail {
 | 
			
		||||
pub mut:
 | 
			
		||||
	email   string
 | 
			
		||||
	label   ContactLabelType // Type of email address
 | 
			
		||||
	primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactPhone represents a phone number with a label
 | 
			
		||||
pub struct ContactPhone {
 | 
			
		||||
pub mut:
 | 
			
		||||
	number  string
 | 
			
		||||
	label   ContactLabelType // Type of phone number
 | 
			
		||||
	primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactAddress represents a physical address with a label
 | 
			
		||||
pub struct ContactAddress {
 | 
			
		||||
pub mut:
 | 
			
		||||
	street      string
 | 
			
		||||
	city        string
 | 
			
		||||
	state       string
 | 
			
		||||
	postal_code string
 | 
			
		||||
	country     string
 | 
			
		||||
	label       ContactLabelType // Type of address
 | 
			
		||||
	primary     bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SocialProfile represents a social media profile
 | 
			
		||||
pub struct SocialProfile {
 | 
			
		||||
pub mut:
 | 
			
		||||
	platform SocialPlatformType // Type of social media platform
 | 
			
		||||
	username string
 | 
			
		||||
	url      string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CustomField represents a user-defined field
 | 
			
		||||
pub struct CustomField {
 | 
			
		||||
pub mut:
 | 
			
		||||
	label string
 | 
			
		||||
	value string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactGroup represents a group of contacts
 | 
			
		||||
pub struct ContactGroup {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	contacts    []u32 // IDs of contacts in this group
 | 
			
		||||
	owner_id    u32   // User who owns this group
 | 
			
		||||
	shared_with []u32 // Users this group is shared with
 | 
			
		||||
}
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// MessagePriority represents the priority level of a message
 | 
			
		||||
pub enum MessagePriority {
 | 
			
		||||
	low
 | 
			
		||||
	normal
 | 
			
		||||
	high
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Message represents an email message that can be used for email as well as chat
 | 
			
		||||
pub struct Message {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	// Database ID
 | 
			
		||||
	conversation_id string       // Grouping ID for messages in the same thread (not an entity foreign key)
 | 
			
		||||
	folder         string       // The folder this email belongs to (e.g., inbox, sent, drafts)
 | 
			
		||||
	labels         []u16        // Numeric label codes, defined in 'message' circle configuration
 | 
			
		||||
	message        string       // The email body content
 | 
			
		||||
	attachments    []u32        // List of Attachment.id references, stored in circle
 | 
			
		||||
	send_time      ourtime.OurTime 
 | 
			
		||||
	scheduled_send ourtime.OurTime // Time to send if scheduled
 | 
			
		||||
	size     u32                  // Size of the message in bytes
 | 
			
		||||
	read     bool                 // Whether the email has been read
 | 
			
		||||
	flagged  bool                 // Whether the email has been flagged/starred
 | 
			
		||||
	priority MessagePriority      // Priority level
 | 
			
		||||
 | 
			
		||||
	// Header information
 | 
			
		||||
	subject     string
 | 
			
		||||
	from        []u32 // List of User.id's who authored the message
 | 
			
		||||
	sender      []u32 // List of User.id's who sent the message (if different from 'from')
 | 
			
		||||
	reply_to    []u32 // List of User.id's to reply to
 | 
			
		||||
	to          []u32 // List of User.id's of primary recipients
 | 
			
		||||
	cc          []u32 // List of User.id's of CC recipients
 | 
			
		||||
	bcc         []u32 // List of User.id's of BCC recipients
 | 
			
		||||
	in_reply_to_message_id u32? // Optional: Message.id of the message this is a reply to
 | 
			
		||||
	draft          bool         // Whether this is a draft message	
 | 
			
		||||
}
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
module projects
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Priority represents the priority level of a project item
 | 
			
		||||
// Priority levels for project items
 | 
			
		||||
pub enum Priority {
 | 
			
		||||
	critical
 | 
			
		||||
	high
 | 
			
		||||
@@ -11,7 +11,7 @@ pub enum Priority {
 | 
			
		||||
	none
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Status represents the current status of a project item
 | 
			
		||||
// Status values for project lifecycle
 | 
			
		||||
pub enum Status {
 | 
			
		||||
	todo
 | 
			
		||||
	in_progress
 | 
			
		||||
@@ -20,7 +20,7 @@ pub enum Status {
 | 
			
		||||
	archived
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ItemType represents the type of a project item
 | 
			
		||||
// Types of items in the project hierarchy
 | 
			
		||||
pub enum ItemType {
 | 
			
		||||
	epic
 | 
			
		||||
	story
 | 
			
		||||
@@ -30,24 +30,28 @@ pub enum ItemType {
 | 
			
		||||
	feature
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Project represents a project in the system
 | 
			
		||||
// Project represents a high-level container for organizing work
 | 
			
		||||
// A Project holds information about its members and contains lists of associated epics, sprints, and boards
 | 
			
		||||
pub struct Project {
 | 
			
		||||
	base.Base
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	owner_id    u32    // ID of the user who owns this project
 | 
			
		||||
	member_ids  []u32  // IDs of the users who are members of this project
 | 
			
		||||
	board_ids   []u32  // IDs of the kanban boards in this project
 | 
			
		||||
	sprint_ids  []u32  // IDs of the sprints in this project
 | 
			
		||||
	epic_ids    []u32  // IDs of the epics in this project
 | 
			
		||||
	tags        []string
 | 
			
		||||
	name        string @[index] // Project name
 | 
			
		||||
	description string // Detailed project description
 | 
			
		||||
	owner_id    u64   @[index] // User ID of the project owner
 | 
			
		||||
	member_ids  []u64 @[index] // List of user IDs who are members
 | 
			
		||||
	board_ids   []u64 // List of associated board IDs
 | 
			
		||||
	sprint_ids  []u64    @[index] // List of sprint IDs in this project
 | 
			
		||||
	epic_ids    []u64    @[index] // List of epic IDs in this project
 | 
			
		||||
	tags        []string @[index] // Project tags for categorization
 | 
			
		||||
	status      Status   @[index] // Current project status
 | 
			
		||||
	priority    Priority @[index] // Project priority level
 | 
			
		||||
	item_type   ItemType @[index] // Type of project item
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Label represents a label that can be applied to project items
 | 
			
		||||
// Label represents a tag with name and color for categorization
 | 
			
		||||
pub struct Label {
 | 
			
		||||
	base.Base
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name  string
 | 
			
		||||
	color string // Hex color code
 | 
			
		||||
}
 | 
			
		||||
	name  string @[index] // Label name
 | 
			
		||||
	color string @[index] // Hex color code for the label
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,37 +1,18 @@
 | 
			
		||||
module projects
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// Epic represents a large body of work that can be broken down into stories
 | 
			
		||||
// Epic represents a large body of work or major feature
 | 
			
		||||
// An Epic is broken down into smaller tasks and can be associated with a project
 | 
			
		||||
pub struct Epic {
 | 
			
		||||
	base.Base
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	title        string
 | 
			
		||||
	description  string
 | 
			
		||||
	project_id   u32      // ID of the project this epic belongs to
 | 
			
		||||
	owner_id     u32      // ID of the user who owns this epic
 | 
			
		||||
	assignee_id  u32      // ID of the user assigned to this epic
 | 
			
		||||
	status       Status
 | 
			
		||||
	priority     Priority
 | 
			
		||||
	story_ids    []u32    // IDs of the stories in this epic
 | 
			
		||||
	issue_ids    []u32    // IDs of the issues in this epic
 | 
			
		||||
	label_ids    []u32    // IDs of the labels applied to this epic
 | 
			
		||||
	start_date   string   // Start date in ISO format
 | 
			
		||||
	due_date     string   // Due date in ISO format
 | 
			
		||||
	progress     f32      // Progress as a percentage (0-100)
 | 
			
		||||
	dependencies []u32    // IDs of epics that this epic depends on
 | 
			
		||||
	blockers     []string // List of blockers preventing progress
 | 
			
		||||
	tags         []string
 | 
			
		||||
	name           string @[index] // Epic name
 | 
			
		||||
	description    string // Detailed epic description
 | 
			
		||||
	status         Status @[index] // Current epic status
 | 
			
		||||
	project_id     u64    @[index] // Link to parent project
 | 
			
		||||
	start_date     u64 // Epic start timestamp (Unix)
 | 
			
		||||
	due_date       u64 // Epic due timestamp (Unix)
 | 
			
		||||
	tags           []string @[index] // Epic tags for categorization
 | 
			
		||||
	child_task_ids []u64    @[index] // List of task IDs belonging to this epic
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EpicProgress represents the progress of an epic
 | 
			
		||||
pub struct EpicProgress {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	epic_id           u32
 | 
			
		||||
	total_stories     u32  // Total number of stories in the epic
 | 
			
		||||
	completed_stories u32  // Number of completed stories
 | 
			
		||||
	total_points      f32  // Total number of story points
 | 
			
		||||
	completed_points  f32  // Number of completed story points
 | 
			
		||||
	progress          f32  // Progress as a percentage (0-100)
 | 
			
		||||
}
 | 
			
		||||
@@ -1,60 +0,0 @@
 | 
			
		||||
module projects
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
// IssueType represents the type of an issue
 | 
			
		||||
pub enum IssueType {
 | 
			
		||||
	bug
 | 
			
		||||
	feature_request
 | 
			
		||||
	improvement
 | 
			
		||||
	task
 | 
			
		||||
	question
 | 
			
		||||
	documentation
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IssueSeverity represents the severity of an issue
 | 
			
		||||
pub enum IssueSeverity {
 | 
			
		||||
	blocker
 | 
			
		||||
	critical
 | 
			
		||||
	major
 | 
			
		||||
	minor
 | 
			
		||||
	trivial
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Issue represents a problem, task, or feature request in the project
 | 
			
		||||
pub struct Issue {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	title        string
 | 
			
		||||
	description  string
 | 
			
		||||
	project_id   u32          // ID of the project this issue belongs to
 | 
			
		||||
	reporter_id  u32          // ID of the user who reported this issue
 | 
			
		||||
	assignee_id  u32          // ID of the user assigned to this issue
 | 
			
		||||
	status       Status
 | 
			
		||||
	priority     Priority
 | 
			
		||||
	issue_type   IssueType
 | 
			
		||||
	severity     IssueSeverity
 | 
			
		||||
	epic_id      u32          // ID of the epic this issue belongs to (if any)
 | 
			
		||||
	story_id     u32          // ID of the story this issue belongs to (if any)
 | 
			
		||||
	sprint_id    u32          // ID of the sprint this issue is scheduled for (if any)
 | 
			
		||||
	label_ids    []u32        // IDs of the labels applied to this issue
 | 
			
		||||
	due_date     string       // Due date in ISO format
 | 
			
		||||
	estimated_hours f32       // Estimated hours to complete
 | 
			
		||||
	actual_hours f32          // Actual hours spent
 | 
			
		||||
	dependencies []u32        // IDs of issues that this issue depends on
 | 
			
		||||
	blockers     []string     // List of blockers preventing progress
 | 
			
		||||
	steps_to_reproduce []string // Steps to reproduce (for bugs)
 | 
			
		||||
	environment  string       // Environment where the issue occurs (for bugs)
 | 
			
		||||
	attachments  []string     // Paths or references to attachments
 | 
			
		||||
	tags         []string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IssueComment represents a comment on an issue
 | 
			
		||||
pub struct IssueComment {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	issue_id    u32
 | 
			
		||||
	author_id   u32
 | 
			
		||||
	content     string
 | 
			
		||||
	attachments []string // Paths or references to attachments
 | 
			
		||||
}
 | 
			
		||||
@@ -1,44 +0,0 @@
 | 
			
		||||
module projects
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
// KanbanBoard represents a kanban board in the project management system
 | 
			
		||||
pub struct KanbanBoard {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	project_id  u32       // ID of the project this board belongs to
 | 
			
		||||
	columns     []Column  // Columns in this kanban board
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Column represents a column in a kanban board
 | 
			
		||||
pub struct Column {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	position    u32      // Position of the column in the board (for ordering)
 | 
			
		||||
	item_ids    []u32    // IDs of the items in this column
 | 
			
		||||
	wip_limit   u32      // Work in progress limit (0 means no limit)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// KanbanItem represents an item on a kanban board
 | 
			
		||||
// This can be linked to an Epic, Story, or Issue
 | 
			
		||||
pub struct KanbanItem {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	title       string
 | 
			
		||||
	description string
 | 
			
		||||
	column_id   u32      // ID of the column this item belongs to
 | 
			
		||||
	position    u32      // Position of the item in the column (for ordering)
 | 
			
		||||
	assignee_id u32      // ID of the user assigned to this item
 | 
			
		||||
	priority    Priority
 | 
			
		||||
	status      Status
 | 
			
		||||
	item_type   ItemType
 | 
			
		||||
	epic_id     u32      // ID of the epic this item belongs to (if any)
 | 
			
		||||
	story_id    u32      // ID of the story this item belongs to (if any)
 | 
			
		||||
	issue_id    u32      // ID of the issue this item is linked to (if any)
 | 
			
		||||
	label_ids   []u32    // IDs of the labels applied to this item
 | 
			
		||||
	due_date    string   // Due date in ISO format
 | 
			
		||||
}
 | 
			
		||||
@@ -1,45 +1,26 @@
 | 
			
		||||
module projects
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// SprintStatus represents the status of a sprint
 | 
			
		||||
// SprintStatus defines the possible states of a sprint
 | 
			
		||||
pub enum SprintStatus {
 | 
			
		||||
	planning
 | 
			
		||||
	active
 | 
			
		||||
	review
 | 
			
		||||
	completed
 | 
			
		||||
	cancelled
 | 
			
		||||
	paused
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Sprint represents a time-boxed period in which specific work has to be completed
 | 
			
		||||
// Sprint represents a time-boxed iteration for completing work
 | 
			
		||||
// Typically used in agile methodologies (e.g., two-week sprints)
 | 
			
		||||
pub struct Sprint {
 | 
			
		||||
	base.Base
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name         string
 | 
			
		||||
	description  string
 | 
			
		||||
	project_id   u32         // ID of the project this sprint belongs to
 | 
			
		||||
	status       SprintStatus
 | 
			
		||||
	start_date   string      // Start date in ISO format
 | 
			
		||||
	end_date     string      // End date in ISO format
 | 
			
		||||
	goal         string      // The goal of this sprint
 | 
			
		||||
	story_ids    []u32       // IDs of the stories in this sprint
 | 
			
		||||
	issue_ids    []u32       // IDs of the issues in this sprint
 | 
			
		||||
	epic_ids     []u32       // IDs of the epics this sprint contributes to
 | 
			
		||||
	velocity     f32         // Planned velocity for this sprint
 | 
			
		||||
	actual_points f32        // Actual story points completed
 | 
			
		||||
	retrospective string     // Notes from the sprint retrospective
 | 
			
		||||
	name        string @[index] // Sprint name
 | 
			
		||||
	description string // Sprint description
 | 
			
		||||
	status      SprintStatus @[index] // Current sprint status
 | 
			
		||||
	goal        string // Sprint goal/objective
 | 
			
		||||
	project_id  u64 @[index] // Link to parent project
 | 
			
		||||
	start_date  u64 // Sprint start timestamp (Unix)
 | 
			
		||||
	end_date    u64 // Sprint end timestamp (Unix)
 | 
			
		||||
	task_ids    []u64 @[index] // List of task IDs in this sprint
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SprintReport represents a report generated at the end of a sprint
 | 
			
		||||
pub struct SprintReport {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	sprint_id       u32
 | 
			
		||||
	completed_items u32      // Number of items completed
 | 
			
		||||
	total_items     u32      // Total number of items
 | 
			
		||||
	completed_points f32     // Number of story points completed
 | 
			
		||||
	total_points    f32      // Total number of story points
 | 
			
		||||
	blockers        []string // List of blockers encountered
 | 
			
		||||
	achievements    []string // List of achievements
 | 
			
		||||
	lessons         []string // Lessons learned
 | 
			
		||||
}
 | 
			
		||||
@@ -1,63 +0,0 @@
 | 
			
		||||
module projects
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
// StorySize represents the size/complexity of a user story
 | 
			
		||||
pub enum StorySize {
 | 
			
		||||
	xs // 1 point
 | 
			
		||||
	s  // 2 points
 | 
			
		||||
	m  // 3 points
 | 
			
		||||
	l  // 5 points
 | 
			
		||||
	xl // 8 points
 | 
			
		||||
	xxl // 13 points
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AcceptanceCriteria represents a single acceptance criterion for a story
 | 
			
		||||
pub struct AcceptanceCriteria {
 | 
			
		||||
pub mut:
 | 
			
		||||
	description string
 | 
			
		||||
	satisfied   bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Story represents a user story in the project management system
 | 
			
		||||
pub struct Story {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	title              string
 | 
			
		||||
	description        string
 | 
			
		||||
	project_id         u32                  // ID of the project this story belongs to
 | 
			
		||||
	epic_id            u32                  // ID of the epic this story belongs to (if any)
 | 
			
		||||
	sprint_id          u32                  // ID of the sprint this story is scheduled for (if any)
 | 
			
		||||
	owner_id           u32                  // ID of the user who owns this story
 | 
			
		||||
	assignee_id        u32                  // ID of the user assigned to this story
 | 
			
		||||
	status             Status
 | 
			
		||||
	priority           Priority
 | 
			
		||||
	size               StorySize
 | 
			
		||||
	points             f32                  // Story points (if not using standard sizes)
 | 
			
		||||
	acceptance_criteria []AcceptanceCriteria // List of acceptance criteria
 | 
			
		||||
	issue_ids          []u32                // IDs of the issues related to this story
 | 
			
		||||
	label_ids          []u32                // IDs of the labels applied to this story
 | 
			
		||||
	dependencies       []u32                // IDs of stories that this story depends on
 | 
			
		||||
	blockers           []string             // List of blockers preventing progress
 | 
			
		||||
	business_value     u32                  // Business value (1-10)
 | 
			
		||||
	user_persona       string               // User persona this story relates to
 | 
			
		||||
	start_date         string               // Start date in ISO format
 | 
			
		||||
	due_date           string               // Due date in ISO format
 | 
			
		||||
	estimated_hours    f32                  // Estimated hours to complete
 | 
			
		||||
	actual_hours       f32                  // Actual hours spent
 | 
			
		||||
	tags               []string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// StoryTask represents a task that needs to be completed for a story
 | 
			
		||||
pub struct StoryTask {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	story_id     u32
 | 
			
		||||
	title        string
 | 
			
		||||
	description  string
 | 
			
		||||
	assignee_id  u32      // ID of the user assigned to this task
 | 
			
		||||
	status       Status
 | 
			
		||||
	estimated_hours f32   // Estimated hours to complete
 | 
			
		||||
	actual_hours f32      // Actual hours spent
 | 
			
		||||
	order        u32      // Order of the task in the story
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								specs/models/projects/task.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								specs/models/projects/task.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
module projects
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.hero.models.core
 | 
			
		||||
 | 
			
		||||
// TaskStatus defines the possible states of a task
 | 
			
		||||
pub enum TaskStatus {
 | 
			
		||||
	todo
 | 
			
		||||
	in_progress
 | 
			
		||||
	in_review
 | 
			
		||||
	done
 | 
			
		||||
	blocked
 | 
			
		||||
	backlog
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TaskPriority defines the priority levels for tasks
 | 
			
		||||
pub enum TaskPriority {
 | 
			
		||||
	low
 | 
			
		||||
	medium
 | 
			
		||||
	high
 | 
			
		||||
	urgent
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Task represents the most granular unit of work
 | 
			
		||||
// Tasks can be linked to projects, epics, and sprints
 | 
			
		||||
pub struct Task {
 | 
			
		||||
	core.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	title                string @[index] // Task title
 | 
			
		||||
	description          string // Task description
 | 
			
		||||
	status               TaskStatus   @[index] // Current task status
 | 
			
		||||
	priority             TaskPriority @[index] // Task priority level
 | 
			
		||||
	assignee_id          u64          @[index] // User ID of task assignee
 | 
			
		||||
	reporter_id          u64          @[index] // User ID of task reporter
 | 
			
		||||
	parent_task_id       u64 // For subtasks - parent task ID
 | 
			
		||||
	epic_id              u64 @[index] // Link to parent epic
 | 
			
		||||
	sprint_id            u64 @[index] // Link to parent sprint
 | 
			
		||||
	project_id           u64 @[index] // Link to parent project
 | 
			
		||||
	due_date             u64 // Task due timestamp (Unix)
 | 
			
		||||
	estimated_time_hours f32 // Estimated hours to complete
 | 
			
		||||
	logged_time_hours    f32 // Actual hours logged
 | 
			
		||||
	tags                 []string @[index] // Task tags for categorization
 | 
			
		||||
}
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
module ticket
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
// TicketStatus and TicketPriority enums are used from ticket_enums.v in the same module
 | 
			
		||||
 | 
			
		||||
// Ticket represents a support ticket in the system
 | 
			
		||||
pub struct Ticket {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	user_id     u32    // Reference to User.id (the user who created the ticket)
 | 
			
		||||
	title       string
 | 
			
		||||
	description string
 | 
			
		||||
	status      TicketStatus
 | 
			
		||||
	priority    TicketPriority
 | 
			
		||||
	assigned_to_user_id u32? // Optional: Reference to User.id (the user assigned to the ticket)
 | 
			
		||||
}
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
module ticket
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// TicketComment represents a comment on a support ticket
 | 
			
		||||
pub struct TicketComment {
 | 
			
		||||
	base.Base // Provides id u32, creation_time, mod_time, comments []u32
 | 
			
		||||
pub mut:
 | 
			
		||||
	ticket_id           u32    // Reference to Ticket.id
 | 
			
		||||
	user_id             u32    // Reference to User.id (author of the comment)
 | 
			
		||||
	content             string
 | 
			
		||||
	is_support_response bool   // True if the comment is from a support agent
 | 
			
		||||
}
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
module ticket
 | 
			
		||||
 | 
			
		||||
// TicketStatus defines the status of a support ticket
 | 
			
		||||
pub enum TicketStatus {
 | 
			
		||||
	open
 | 
			
		||||
	in_progress
 | 
			
		||||
	waiting_for_customer
 | 
			
		||||
	resolved
 | 
			
		||||
	closed
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TicketPriority defines the priority of a support ticket
 | 
			
		||||
pub enum TicketPriority {
 | 
			
		||||
	low
 | 
			
		||||
	medium
 | 
			
		||||
	high
 | 
			
		||||
	critical
 | 
			
		||||
}
 | 
			
		||||
@@ -1,20 +0,0 @@
 | 
			
		||||
module user
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// UserRole represents the possible roles a user can have
 | 
			
		||||
pub enum UserRole {
 | 
			
		||||
	user
 | 
			
		||||
	admin
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// User represents a user in the system
 | 
			
		||||
pub struct User {
 | 
			
		||||
	base.Base // Base struct for common fields (id u32, creation_time, mod_time, comments []u32)
 | 
			
		||||
pub mut:
 | 
			
		||||
	name          string
 | 
			
		||||
	email         string
 | 
			
		||||
	password_hash string // Hashed password
 | 
			
		||||
	role          UserRole
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user