threefold.models_to_move.legal #
fn Contract.new #
fn Contract.new(contract_id string) Contract
new creates a new Contract
fn ContractRevision.new #
fn ContractRevision.new(version u32, content string, created_by string) ContractRevision
new creates a new ContractRevision
fn ContractSigner.new #
fn ContractSigner.new(id string, name string, email string) ContractSigner
new creates a new ContractSigner
enum ContractStatus #
enum ContractStatus {
draft // Contract is in draft state
pending_signatures // Waiting for signatures
signed // All parties have signed
active // Contract is active
expired // Contract has expired
cancelled // Contract was cancelled
}
ContractStatus defines the possible statuses of a contract
enum SignerStatus #
enum SignerStatus {
pending // Signature is pending
signed // Signer has signed
rejected // Signer rejected the contract
}
SignerStatus defines the status of a contract signer
struct Contract #
struct Contract {
pub mut:
id u32 // Unique contract ID
contract_id string // Unique UUID for the contract
title string // Contract title
description string // Contract description
contract_type string // Type of contract
status ContractStatus // Current status
created_by string // Who created the contract
terms_and_conditions string // Terms and conditions text
start_date ?u64 // Optional start date
end_date ?u64 // Optional end date
renewal_period_days ?i32 // Optional renewal period in days
next_renewal_date ?u64 // Optional next renewal date
signers []ContractSigner // List of signers
revisions []ContractRevision // Contract revisions
current_version u32 // Current version number
last_signed_date ?u64 // Last signing date
created_at u64 // Creation timestamp
updated_at u64 // Last update timestamp
}
Contract represents a legal agreement
fn (Contract) title #
fn (mut c Contract) title(title string) Contract
title sets the contract title (builder pattern)
fn (Contract) description #
fn (mut c Contract) description(description string) Contract
description sets the contract description (builder pattern)
fn (Contract) contract_type #
fn (mut c Contract) contract_type(contract_type string) Contract
contract_type sets the contract type (builder pattern)
fn (Contract) status #
fn (mut c Contract) status(status ContractStatus) Contract
status sets the contract status (builder pattern)
fn (Contract) created_by #
fn (mut c Contract) created_by(created_by string) Contract
created_by sets who created the contract (builder pattern)
fn (Contract) terms_and_conditions #
fn (mut c Contract) terms_and_conditions(terms string) Contract
terms_and_conditions sets the terms (builder pattern)
fn (Contract) start_date #
fn (mut c Contract) start_date(start_date u64) Contract
start_date sets the start date (builder pattern)
fn (Contract) end_date #
fn (mut c Contract) end_date(end_date u64) Contract
end_date sets the end date (builder pattern)
fn (Contract) renewal_period_days #
fn (mut c Contract) renewal_period_days(days i32) Contract
renewal_period_days sets the renewal period (builder pattern)
fn (Contract) next_renewal_date #
fn (mut c Contract) next_renewal_date(date u64) Contract
next_renewal_date sets the next renewal date (builder pattern)
fn (Contract) add_signer #
fn (mut c Contract) add_signer(signer ContractSigner) Contract
add_signer adds a signer to the contract (builder pattern)
fn (Contract) signers #
fn (mut c Contract) signers(signers []ContractSigner) Contract
signers sets all signers (builder pattern)
fn (Contract) add_revision #
fn (mut c Contract) add_revision(revision ContractRevision) Contract
add_revision adds a revision to the contract (builder pattern)
fn (Contract) revisions #
fn (mut c Contract) revisions(revisions []ContractRevision) Contract
revisions sets all revisions (builder pattern)
fn (Contract) current_version #
fn (mut c Contract) current_version(version u32) Contract
current_version sets the current version (builder pattern)
fn (Contract) last_signed_date #
fn (mut c Contract) last_signed_date(date u64) Contract
last_signed_date sets the last signed date (builder pattern)
fn (Contract) set_status #
fn (mut c Contract) set_status(status ContractStatus)
set_status sets the contract status and updates timestamp
fn (Contract) is_draft #
fn (c Contract) is_draft() bool
is_draft checks if contract is in draft status
fn (Contract) is_pending_signatures #
fn (c Contract) is_pending_signatures() bool
is_pending_signatures checks if contract is pending signatures
fn (Contract) is_signed #
fn (c Contract) is_signed() bool
is_signed checks if contract is signed
fn (Contract) is_active #
fn (c Contract) is_active() bool
is_active checks if contract is active
fn (Contract) is_expired #
fn (c Contract) is_expired() bool
is_expired checks if contract is expired
fn (Contract) is_cancelled #
fn (c Contract) is_cancelled() bool
is_cancelled checks if contract is cancelled
fn (Contract) get_pending_signers #
fn (c Contract) get_pending_signers() []ContractSigner
get_pending_signers returns signers with pending status
fn (Contract) get_signed_signers #
fn (c Contract) get_signed_signers() []ContractSigner
get_signed_signers returns signers who have signed
fn (Contract) all_signed #
fn (c Contract) all_signed() bool
all_signed checks if all signers have signed
fn (Contract) get_signer_by_id #
fn (c Contract) get_signer_by_id(id string) ?ContractSigner
get_signer_by_id finds a signer by ID
fn (Contract) get_current_revision #
fn (c Contract) get_current_revision() ?ContractRevision
get_current_revision gets the current revision
fn (Contract) status_string #
fn (c Contract) status_string() string
status_string returns the status as a string
struct ContractRevision #
struct ContractRevision {
pub mut:
version u32 // Version number
content string // Contract content for this version
created_at u64 // Creation timestamp
created_by string // Who created this revision
comments ?string // Optional comments about this revision
}
ContractRevision represents a version of the contract content
fn (ContractRevision) comments #
fn (mut cr ContractRevision) comments(comments string) ContractRevision
comments sets comments for the revision (builder pattern)
struct ContractSigner #
struct ContractSigner {
pub mut:
id string // Unique ID for the signer (UUID string)
name string // Signer's name
email string // Signer's email
status SignerStatus // Current status
signed_at ?u64 // When they signed (optional)
comments ?string // Optional comments from signer
last_reminder_mail_sent_at ?u64 // Last reminder timestamp
signature_data ?string // Base64 encoded signature image data
}
ContractSigner represents a party involved in signing a contract
fn (ContractSigner) status #
fn (mut cs ContractSigner) status(status SignerStatus) ContractSigner
status sets the signer status (builder pattern)
fn (ContractSigner) signed_at #
fn (mut cs ContractSigner) signed_at(signed_at u64) ContractSigner
signed_at sets the signing timestamp (builder pattern)
fn (ContractSigner) comments #
fn (mut cs ContractSigner) comments(comments string) ContractSigner
comments sets comments (builder pattern)
fn (ContractSigner) signature_data #
fn (mut cs ContractSigner) signature_data(signature_data string) ContractSigner
signature_data sets the signature data (builder pattern)
fn (ContractSigner) can_send_reminder #
fn (cs ContractSigner) can_send_reminder() bool
can_send_reminder checks if a reminder can be sent (30-minute rate limiting)
fn (ContractSigner) reminder_cooldown_remaining #
fn (cs ContractSigner) reminder_cooldown_remaining() ?u64
reminder_cooldown_remaining gets remaining cooldown time in seconds
fn (ContractSigner) mark_reminder_sent #
fn (mut cs ContractSigner) mark_reminder_sent()
mark_reminder_sent updates the reminder timestamp to current time
fn (ContractSigner) sign #
fn (mut cs ContractSigner) sign(signature_data ?string, comments ?string)
sign signs the contract with optional signature data and comments
- fn Contract.new
- fn ContractRevision.new
- fn ContractSigner.new
- enum ContractStatus
- enum SignerStatus
- struct Contract
- fn title
- fn description
- fn contract_type
- fn status
- fn created_by
- fn terms_and_conditions
- fn start_date
- fn end_date
- fn renewal_period_days
- fn next_renewal_date
- fn add_signer
- fn signers
- fn add_revision
- fn revisions
- fn current_version
- fn last_signed_date
- fn set_status
- fn is_draft
- fn is_pending_signatures
- fn is_signed
- fn is_active
- fn is_expired
- fn is_cancelled
- fn get_pending_signers
- fn get_signed_signers
- fn all_signed
- fn get_signer_by_id
- fn get_current_revision
- fn status_string
- struct ContractRevision
- struct ContractSigner