UNPKG

business-as-code

Version:

Primitives for expressing business logic and processes as code

311 lines (301 loc) 22 kB
import type { Noun } from 'ai-database' /** * Legal Entities * Agreement, Contract, License, IntellectualProperty, Compliance, Policy, Trademark */ export const Agreement: Noun = { singular: 'agreement', plural: 'agreements', description: 'A legal agreement or contract between parties', properties: { name: { type: 'string', description: 'Agreement name or title' }, type: { type: 'string', description: 'Type of agreement', examples: ['NDA', 'MSA', 'SOW', 'SLA', 'DPA', 'employment', 'partnership', 'licensing', 'distribution', 'consulting', 'subscription'] }, status: { type: 'string', description: 'Agreement status', examples: ['draft', 'review', 'negotiation', 'pending-signature', 'active', 'expired', 'terminated', 'renewed'] }, description: { type: 'string', description: 'Agreement description' }, parties: { type: 'string[]', description: 'Parties to the agreement' }, counterparty: { type: 'string', description: 'Primary counterparty' }, effectiveDate: { type: 'date', description: 'Agreement effective date' }, expirationDate: { type: 'date', description: 'Agreement expiration date' }, terminationDate: { type: 'date', description: 'Actual termination date', optional: true }, term: { type: 'string', description: 'Agreement term length', examples: ['1-year', '2-year', '3-year', 'perpetual', 'month-to-month'] }, autoRenew: { type: 'boolean', description: 'Auto-renewal enabled' }, renewalTerms: { type: 'string', description: 'Renewal terms' }, noticePeriod: { type: 'number', description: 'Notice period in days' }, value: { type: 'number', description: 'Total agreement value' }, currency: { type: 'string', description: 'Currency' }, paymentTerms: { type: 'string', description: 'Payment terms' }, governingLaw: { type: 'string', description: 'Governing law jurisdiction' }, disputeResolution: { type: 'string', description: 'Dispute resolution method', examples: ['litigation', 'arbitration', 'mediation'] }, confidentiality: { type: 'boolean', description: 'Contains confidentiality provisions' }, nonCompete: { type: 'boolean', description: 'Contains non-compete clause' }, exclusivity: { type: 'boolean', description: 'Contains exclusivity provisions' }, indemnification: { type: 'boolean', description: 'Contains indemnification clause' }, liabilityLimit: { type: 'number', description: 'Liability limitation amount', optional: true }, version: { type: 'string', description: 'Document version' }, documentUrl: { type: 'string', description: 'Document storage URL' }, signedCopyUrl: { type: 'string', description: 'Signed copy URL', optional: true }, signatories: { type: 'string[]', description: 'Signatories' }, signedDate: { type: 'date', description: 'Date signed', optional: true }, internalOwner: { type: 'string', description: 'Internal contract owner' }, legalReviewer: { type: 'string', description: 'Legal reviewer' }, approver: { type: 'string', description: 'Approval authority' }, approvalDate: { type: 'date', description: 'Approval date', optional: true }, amendments: { type: 'number', description: 'Number of amendments' }, lastAmendmentDate: { type: 'date', description: 'Last amendment date', optional: true }, tags: { type: 'string[]', description: 'Agreement tags' }, notes: { type: 'string', description: 'Internal notes', optional: true }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { customer: { type: 'customer', description: 'Related customer', backref: 'agreements' }, partner: { type: 'partner', description: 'Related partner', backref: 'agreements' }, vendor: { type: 'vendor', description: 'Related vendor', backref: 'agreements' }, parentAgreement: { type: 'agreement', description: 'Parent master agreement', backref: 'childAgreements' }, amendments: { type: 'agreement[]', description: 'Amendment documents', backref: 'parentAgreement' }, relatedDeals: { type: 'deal[]', description: 'Related deals', backref: 'agreement' }, }, actions: ['create', 'update', 'draft', 'review', 'negotiate', 'approve', 'reject', 'sign', 'execute', 'amend', 'renew', 'terminate', 'expire', 'archive'], events: ['created', 'updated', 'drafted', 'reviewed', 'negotiated', 'approved', 'rejected', 'signed', 'executed', 'amended', 'renewed', 'terminated', 'expired', 'archived'], } export const License: Noun = { singular: 'license', plural: 'licenses', description: 'A license granted for software, content, or intellectual property', properties: { name: { type: 'string', description: 'License name' }, type: { type: 'string', description: 'Type of license', examples: ['software', 'content', 'patent', 'trademark', 'copyright', 'API', 'SDK', 'data'] }, model: { type: 'string', description: 'License model', examples: ['perpetual', 'subscription', 'usage-based', 'seat-based', 'site', 'enterprise', 'OEM'] }, status: { type: 'string', description: 'License status', examples: ['draft', 'active', 'suspended', 'expired', 'revoked', 'transferred'] }, licenseKey: { type: 'string', description: 'License key or identifier' }, version: { type: 'string', description: 'Licensed version' }, product: { type: 'string', description: 'Licensed product' }, edition: { type: 'string', description: 'Product edition', examples: ['free', 'starter', 'professional', 'enterprise', 'ultimate'] }, seats: { type: 'number', description: 'Number of seats/users' }, maxSeats: { type: 'number', description: 'Maximum allowed seats' }, usedSeats: { type: 'number', description: 'Currently used seats' }, instances: { type: 'number', description: 'Allowed instances' }, environments: { type: 'string[]', description: 'Allowed environments', examples: ['production', 'staging', 'development', 'test'] }, features: { type: 'string[]', description: 'Licensed features' }, restrictions: { type: 'string[]', description: 'License restrictions' }, territory: { type: 'string', description: 'Geographic territory' }, exclusivity: { type: 'boolean', description: 'Exclusive license' }, transferable: { type: 'boolean', description: 'License is transferable' }, sublicensable: { type: 'boolean', description: 'Can grant sublicenses' }, issueDate: { type: 'date', description: 'License issue date' }, activationDate: { type: 'date', description: 'License activation date' }, expirationDate: { type: 'date', description: 'License expiration date' }, maintenanceExpiry: { type: 'date', description: 'Maintenance expiration', optional: true }, supportLevel: { type: 'string', description: 'Support level', examples: ['community', 'basic', 'standard', 'premium', 'enterprise'] }, fee: { type: 'number', description: 'License fee' }, currency: { type: 'string', description: 'Currency' }, billingCycle: { type: 'string', description: 'Billing cycle', examples: ['one-time', 'monthly', 'quarterly', 'annual'] }, autoRenew: { type: 'boolean', description: 'Auto-renewal enabled' }, licensor: { type: 'string', description: 'Licensor name' }, licensee: { type: 'string', description: 'Licensee name' }, assignedTo: { type: 'string', description: 'Assigned user/team' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'License tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { agreement: { type: 'agreement', description: 'License agreement', backref: 'licenses' }, customer: { type: 'customer', description: 'Licensed customer', backref: 'licenses' }, subscription: { type: 'subscription', description: 'Related subscription', backref: 'license' }, product: { type: 'product', description: 'Licensed product', backref: 'licenses' }, ip: { type: 'intellectualProperty', description: 'Related IP', backref: 'licenses' }, }, actions: ['create', 'update', 'issue', 'activate', 'suspend', 'renew', 'upgrade', 'downgrade', 'transfer', 'revoke', 'expire'], events: ['created', 'updated', 'issued', 'activated', 'suspended', 'renewed', 'upgraded', 'downgraded', 'transferred', 'revoked', 'expired'], } export const IntellectualProperty: Noun = { singular: 'intellectualProperty', plural: 'intellectualProperties', description: 'Intellectual property assets owned or licensed by the organization', properties: { name: { type: 'string', description: 'IP name or title' }, type: { type: 'string', description: 'Type of IP', examples: ['patent', 'trademark', 'copyright', 'trade-secret', 'design', 'domain', 'software'] }, status: { type: 'string', description: 'IP status', examples: ['idea', 'pending', 'filed', 'published', 'registered', 'granted', 'expired', 'abandoned', 'opposed'] }, description: { type: 'string', description: 'IP description' }, registrationNumber: { type: 'string', description: 'Registration or application number' }, serialNumber: { type: 'string', description: 'Serial number' }, filingDate: { type: 'date', description: 'Filing date' }, registrationDate: { type: 'date', description: 'Registration date' }, expirationDate: { type: 'date', description: 'Expiration date' }, priorityDate: { type: 'date', description: 'Priority date', optional: true }, publicationDate: { type: 'date', description: 'Publication date', optional: true }, jurisdiction: { type: 'string', description: 'Primary jurisdiction' }, jurisdictions: { type: 'string[]', description: 'All jurisdictions filed' }, classes: { type: 'string[]', description: 'Classification classes' }, claims: { type: 'string[]', description: 'Patent claims', optional: true }, inventors: { type: 'string[]', description: 'Inventors or creators' }, owner: { type: 'string', description: 'IP owner' }, assignee: { type: 'string', description: 'Current assignee' }, attorney: { type: 'string', description: 'Attorney or agent' }, lawFirm: { type: 'string', description: 'Law firm' }, docketNumber: { type: 'string', description: 'Internal docket number' }, cost: { type: 'number', description: 'Total cost to date' }, maintenanceFees: { type: 'number', description: 'Annual maintenance fees' }, nextMaintenanceDate: { type: 'date', description: 'Next maintenance due', optional: true }, value: { type: 'number', description: 'Estimated value' }, licensed: { type: 'boolean', description: 'Is licensed to others' }, licensedFrom: { type: 'string', description: 'Licensed from', optional: true }, relatedProducts: { type: 'string[]', description: 'Related products' }, documentUrl: { type: 'string', description: 'Document storage URL' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'IP tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { licenses: { type: 'license[]', description: 'Outbound licenses', backref: 'ip' }, inboundLicenses: { type: 'license[]', description: 'Inbound licenses', backref: 'licensedIP' }, products: { type: 'product[]', description: 'Related products', backref: 'ip' }, agreements: { type: 'agreement[]', description: 'Related agreements', backref: 'ip' }, relatedIP: { type: 'intellectualProperty[]', description: 'Related IP assets', backref: 'relatedIP' }, }, actions: ['create', 'update', 'file', 'register', 'publish', 'grant', 'maintain', 'renew', 'license', 'assign', 'abandon', 'enforce'], events: ['created', 'updated', 'filed', 'registered', 'published', 'granted', 'maintained', 'renewed', 'licensed', 'assigned', 'abandoned', 'enforced'], } export const Compliance: Noun = { singular: 'compliance', plural: 'compliances', description: 'A compliance requirement, certification, or regulatory obligation', properties: { name: { type: 'string', description: 'Compliance name' }, type: { type: 'string', description: 'Type of compliance', examples: ['regulation', 'certification', 'standard', 'policy', 'audit', 'attestation'] }, framework: { type: 'string', description: 'Compliance framework', examples: ['SOC2', 'ISO27001', 'GDPR', 'HIPAA', 'PCI-DSS', 'SOX', 'CCPA', 'FedRAMP', 'NIST'] }, status: { type: 'string', description: 'Compliance status', examples: ['not-started', 'in-progress', 'compliant', 'non-compliant', 'remediation', 'expired', 'exempt'] }, scope: { type: 'string', description: 'Compliance scope' }, description: { type: 'string', description: 'Compliance description' }, requirements: { type: 'string[]', description: 'List of requirements' }, controls: { type: 'string[]', description: 'Control mappings' }, jurisdiction: { type: 'string', description: 'Applicable jurisdiction' }, regulatoryBody: { type: 'string', description: 'Regulatory body' }, certificationBody: { type: 'string', description: 'Certification body' }, auditor: { type: 'string', description: 'External auditor' }, internalOwner: { type: 'string', description: 'Internal compliance owner' }, effectiveDate: { type: 'date', description: 'Effective date' }, certificationDate: { type: 'date', description: 'Certification date' }, expirationDate: { type: 'date', description: 'Expiration date' }, nextAuditDate: { type: 'date', description: 'Next audit date' }, lastAuditDate: { type: 'date', description: 'Last audit date' }, auditFrequency: { type: 'string', description: 'Audit frequency', examples: ['annual', 'semi-annual', 'quarterly', 'continuous'] }, findings: { type: 'number', description: 'Number of findings' }, criticalFindings: { type: 'number', description: 'Critical findings count' }, remediationDeadline: { type: 'date', description: 'Remediation deadline', optional: true }, complianceScore: { type: 'number', description: 'Compliance score/percentage' }, cost: { type: 'number', description: 'Total compliance cost' }, certificationCost: { type: 'number', description: 'Certification cost' }, documentUrl: { type: 'string', description: 'Certificate or report URL' }, evidenceUrl: { type: 'string', description: 'Evidence repository URL' }, publiclyDisclosed: { type: 'boolean', description: 'Publicly disclosed' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Compliance tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { policies: { type: 'policy[]', description: 'Related policies', backref: 'compliance' }, risks: { type: 'risk[]', description: 'Related risks', backref: 'compliance' }, incidents: { type: 'incident[]', description: 'Related incidents', backref: 'compliance' }, agreements: { type: 'agreement[]', description: 'Related agreements', backref: 'compliance' }, tasks: { type: 'task[]', description: 'Compliance tasks', backref: 'compliance' }, }, actions: ['create', 'update', 'assess', 'audit', 'certify', 'remediate', 'renew', 'expire', 'exempt', 'report'], events: ['created', 'updated', 'assessed', 'audited', 'certified', 'remediated', 'renewed', 'expired', 'exempted', 'reported'], } export const LegalPolicy: Noun = { singular: 'legalPolicy', plural: 'legalPolicies', description: 'A legal or corporate policy document', properties: { name: { type: 'string', description: 'Policy name' }, type: { type: 'string', description: 'Type of policy', examples: ['privacy', 'security', 'HR', 'ethics', 'acceptable-use', 'data-retention', 'BYOD', 'travel', 'expense', 'procurement'] }, status: { type: 'string', description: 'Policy status', examples: ['draft', 'review', 'approved', 'published', 'deprecated', 'archived'] }, version: { type: 'string', description: 'Policy version' }, description: { type: 'string', description: 'Policy description' }, purpose: { type: 'string', description: 'Policy purpose' }, scope: { type: 'string', description: 'Policy scope' }, applicableTo: { type: 'string[]', description: 'Applicable to', examples: ['all-employees', 'contractors', 'vendors', 'customers', 'executives'] }, effectiveDate: { type: 'date', description: 'Effective date' }, reviewDate: { type: 'date', description: 'Next review date' }, lastReviewDate: { type: 'date', description: 'Last review date' }, expirationDate: { type: 'date', description: 'Expiration date', optional: true }, reviewCycle: { type: 'string', description: 'Review cycle', examples: ['annual', 'semi-annual', 'quarterly', 'as-needed'] }, owner: { type: 'string', description: 'Policy owner' }, author: { type: 'string', description: 'Policy author' }, approver: { type: 'string', description: 'Policy approver' }, legalReviewer: { type: 'string', description: 'Legal reviewer' }, department: { type: 'string', description: 'Owning department' }, category: { type: 'string', description: 'Policy category' }, relatedRegulations: { type: 'string[]', description: 'Related regulations' }, exceptions: { type: 'string', description: 'Exception process' }, enforcement: { type: 'string', description: 'Enforcement mechanism' }, penalties: { type: 'string', description: 'Violation penalties' }, trainingRequired: { type: 'boolean', description: 'Training required' }, acknowledgmentRequired: { type: 'boolean', description: 'Acknowledgment required' }, acknowledgmentCount: { type: 'number', description: 'Number of acknowledgments' }, documentUrl: { type: 'string', description: 'Policy document URL' }, publicUrl: { type: 'string', description: 'Public policy URL', optional: true }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Policy tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { compliance: { type: 'compliance[]', description: 'Related compliance', backref: 'policies' }, parentPolicy: { type: 'legalPolicy', description: 'Parent policy', backref: 'childPolicies' }, childPolicies: { type: 'legalPolicy[]', description: 'Child policies', backref: 'parentPolicy' }, relatedPolicies: { type: 'legalPolicy[]', description: 'Related policies', backref: 'relatedPolicies' }, department: { type: 'department', description: 'Owning department', backref: 'policies' }, }, actions: ['create', 'update', 'draft', 'review', 'approve', 'publish', 'deprecate', 'archive', 'acknowledge', 'enforce'], events: ['created', 'updated', 'drafted', 'reviewed', 'approved', 'published', 'deprecated', 'archived', 'acknowledged', 'enforced'], } export const Trademark: Noun = { singular: 'trademark', plural: 'trademarks', description: 'A trademark or service mark', properties: { name: { type: 'string', description: 'Trademark name' }, mark: { type: 'string', description: 'The trademark text or symbol' }, type: { type: 'string', description: 'Type of mark', examples: ['word', 'design', 'combined', 'sound', 'color', 'motion', '3D'] }, status: { type: 'string', description: 'Trademark status', examples: ['concept', 'search', 'filed', 'published', 'opposed', 'registered', 'renewed', 'expired', 'abandoned', 'cancelled'] }, registrationNumber: { type: 'string', description: 'Registration number' }, applicationNumber: { type: 'string', description: 'Application number' }, filingDate: { type: 'date', description: 'Filing date' }, registrationDate: { type: 'date', description: 'Registration date' }, expirationDate: { type: 'date', description: 'Expiration date' }, firstUseDate: { type: 'date', description: 'First use date' }, firstUseCommerceDate: { type: 'date', description: 'First use in commerce date' }, jurisdiction: { type: 'string', description: 'Primary jurisdiction' }, jurisdictions: { type: 'string[]', description: 'All registered jurisdictions' }, classes: { type: 'string[]', description: 'Nice classification classes' }, goodsServices: { type: 'string', description: 'Goods and services description' }, owner: { type: 'string', description: 'Trademark owner' }, attorney: { type: 'string', description: 'Trademark attorney' }, imageUrl: { type: 'string', description: 'Mark image URL' }, usageGuidelines: { type: 'string', description: 'Usage guidelines URL' }, monitoringEnabled: { type: 'boolean', description: 'Monitoring enabled' }, nextRenewalDate: { type: 'date', description: 'Next renewal date' }, maintenanceDue: { type: 'date', description: 'Maintenance filing due' }, cost: { type: 'number', description: 'Total cost' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Trademark tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { ip: { type: 'intellectualProperty', description: 'Related IP record', backref: 'trademarks' }, licenses: { type: 'license[]', description: 'Trademark licenses', backref: 'trademark' }, products: { type: 'product[]', description: 'Associated products', backref: 'trademarks' }, }, actions: ['create', 'update', 'search', 'file', 'register', 'renew', 'maintain', 'license', 'abandon', 'cancel', 'enforce', 'monitor'], events: ['created', 'updated', 'searched', 'filed', 'registered', 'renewed', 'maintained', 'licensed', 'abandoned', 'cancelled', 'enforced', 'monitored'], } // Export all legal entities export const LegalEntities = { Agreement, License, IntellectualProperty, Compliance, LegalPolicy, Trademark, } export default LegalEntities