@prefix crm: <http://ggen.io/ontology/crm#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

# ============================================================================
# CRM Customer Management Ontology
# Sales pipeline, customer relationships, and opportunity tracking
# ============================================================================

# ----------------------------------------------------------------------------
# Core Classes - Customers and Contacts
# ----------------------------------------------------------------------------

crm:Customer a owl:Class ;
    rdfs:label "Customer" ;
    rdfs:comment "Business entity or individual customer" .

crm:Contact a owl:Class ;
    rdfs:label "Contact" ;
    rdfs:comment "Individual person at a customer organization" .

crm:Account a owl:Class ;
    rdfs:label "Account" ;
    rdfs:comment "Customer account with relationship hierarchy" .

crm:AccountHierarchy a owl:Class ;
    rdfs:label "Account Hierarchy" ;
    rdfs:comment "Parent-child relationships between accounts" .

crm:CustomerType a owl:Class ;
    rdfs:label "Customer Type" ;
    rdfs:comment "Classification of customer (Prospect, Active, Inactive)" .

# ----------------------------------------------------------------------------
# Sales Pipeline and Opportunities
# ----------------------------------------------------------------------------

crm:Opportunity a owl:Class ;
    rdfs:label "Opportunity" ;
    rdfs:comment "Sales opportunity in the pipeline" .

crm:OpportunityStage a owl:Class ;
    rdfs:label "Opportunity Stage" ;
    rdfs:comment "Stage in the sales process" .

crm:Pipeline a owl:Class ;
    rdfs:label "Sales Pipeline" ;
    rdfs:comment "Collection of opportunities grouped by stage" .

crm:Forecast a owl:Class ;
    rdfs:label "Sales Forecast" ;
    rdfs:comment "Projected revenue based on pipeline" .

crm:Quote a owl:Class ;
    rdfs:label "Quote" ;
    rdfs:comment "Formal price quotation for an opportunity" .

# ----------------------------------------------------------------------------
# Sales Activities
# ----------------------------------------------------------------------------

crm:Activity a owl:Class ;
    rdfs:label "Activity" ;
    rdfs:comment "Sales or service activity (call, email, meeting)" .

crm:Call a owl:Class ;
    rdfs:subClassOf crm:Activity ;
    rdfs:label "Phone Call" ;
    rdfs:comment "Phone call activity" .

crm:Email a owl:Class ;
    rdfs:subClassOf crm:Activity ;
    rdfs:label "Email" ;
    rdfs:comment "Email communication activity" .

crm:Meeting a owl:Class ;
    rdfs:subClassOf crm:Activity ;
    rdfs:label "Meeting" ;
    rdfs:comment "In-person or virtual meeting" .

crm:Task a owl:Class ;
    rdfs:subClassOf crm:Activity ;
    rdfs:label "Task" ;
    rdfs:comment "Follow-up task or action item" .

# ----------------------------------------------------------------------------
# Lead Management
# ----------------------------------------------------------------------------

crm:Lead a owl:Class ;
    rdfs:label "Lead" ;
    rdfs:comment "Prospective customer not yet qualified" .

crm:LeadSource a owl:Class ;
    rdfs:label "Lead Source" ;
    rdfs:comment "Origin of the lead (Web, Referral, Event)" .

crm:LeadScore a owl:Class ;
    rdfs:label "Lead Score" ;
    rdfs:comment "Qualification score for a lead" .

crm:LeadStatus a owl:Class ;
    rdfs:label "Lead Status" ;
    rdfs:comment "Current status of lead (New, Qualified, Disqualified)" .

# ----------------------------------------------------------------------------
# Campaign Management
# ----------------------------------------------------------------------------

crm:Campaign a owl:Class ;
    rdfs:label "Marketing Campaign" ;
    rdfs:comment "Marketing or sales campaign" .

crm:CampaignMember a owl:Class ;
    rdfs:label "Campaign Member" ;
    rdfs:comment "Contact or lead associated with a campaign" .

crm:CampaignResponse a owl:Class ;
    rdfs:label "Campaign Response" ;
    rdfs:comment "Response to a campaign (Responded, No Response)" .

# ----------------------------------------------------------------------------
# Customer Lifecycle
# ----------------------------------------------------------------------------

crm:LifecycleStage a owl:Class ;
    rdfs:label "Lifecycle Stage" ;
    rdfs:comment "Stage in customer journey (Prospect, Customer, Advocate)" .

crm:CustomerSegment a owl:Class ;
    rdfs:label "Customer Segment" ;
    rdfs:comment "Market segment or customer category" .

crm:CustomerTier a owl:Class ;
    rdfs:label "Customer Tier" ;
    rdfs:comment "Customer value tier (Bronze, Silver, Gold, Platinum)" .

# ----------------------------------------------------------------------------
# Territory and Quota
# ----------------------------------------------------------------------------

crm:Territory a owl:Class ;
    rdfs:label "Sales Territory" ;
    rdfs:comment "Geographic or industry-based sales territory" .

crm:TerritoryAssignment a owl:Class ;
    rdfs:label "Territory Assignment" ;
    rdfs:comment "Assignment of accounts/leads to territories" .

crm:Quota a owl:Class ;
    rdfs:label "Sales Quota" ;
    rdfs:comment "Sales target for a period" .

crm:SalesRep a owl:Class ;
    rdfs:label "Sales Representative" ;
    rdfs:comment "Sales person or account manager" .

# ----------------------------------------------------------------------------
# Integration Points
# ----------------------------------------------------------------------------

crm:EmailIntegration a owl:Class ;
    rdfs:label "Email Integration" ;
    rdfs:comment "Connection to email system (Gmail, Outlook)" .

crm:CalendarIntegration a owl:Class ;
    rdfs:label "Calendar Integration" ;
    rdfs:comment "Connection to calendar system" .

crm:SocialMediaProfile a owl:Class ;
    rdfs:label "Social Media Profile" ;
    rdfs:comment "Customer's social media presence" .

# ----------------------------------------------------------------------------
# Properties - Customer and Contact
# ----------------------------------------------------------------------------

crm:customerId a owl:DatatypeProperty ;
    rdfs:domain crm:Customer ;
    rdfs:range xsd:string ;
    rdfs:label "Customer ID" .

crm:customerName a owl:DatatypeProperty ;
    rdfs:domain crm:Customer ;
    rdfs:range xsd:string ;
    rdfs:label "Customer Name" .

crm:accountNumber a owl:DatatypeProperty ;
    rdfs:domain crm:Account ;
    rdfs:range xsd:string ;
    rdfs:label "Account Number" .

crm:parentAccount a owl:ObjectProperty ;
    rdfs:domain crm:Account ;
    rdfs:range crm:Account ;
    rdfs:label "Parent Account" .

crm:contactName a owl:DatatypeProperty ;
    rdfs:domain crm:Contact ;
    rdfs:range xsd:string ;
    rdfs:label "Contact Name" .

crm:contactEmail a owl:DatatypeProperty ;
    rdfs:domain crm:Contact ;
    rdfs:range xsd:string ;
    rdfs:label "Email Address" .

crm:contactPhone a owl:DatatypeProperty ;
    rdfs:domain crm:Contact ;
    rdfs:range xsd:string ;
    rdfs:label "Phone Number" .

crm:title a owl:DatatypeProperty ;
    rdfs:domain crm:Contact ;
    rdfs:range xsd:string ;
    rdfs:label "Job Title" .

crm:primaryContact a owl:ObjectProperty ;
    rdfs:domain crm:Account ;
    rdfs:range crm:Contact ;
    rdfs:label "Primary Contact" .

# ----------------------------------------------------------------------------
# Properties - Opportunities
# ----------------------------------------------------------------------------

crm:opportunityId a owl:DatatypeProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range xsd:string ;
    rdfs:label "Opportunity ID" .

crm:opportunityName a owl:DatatypeProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range xsd:string ;
    rdfs:label "Opportunity Name" .

crm:amount a owl:DatatypeProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range xsd:decimal ;
    rdfs:label "Opportunity Amount" .

crm:probability a owl:DatatypeProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range xsd:decimal ;
    rdfs:label "Win Probability (0-100)" .

crm:expectedRevenue a owl:DatatypeProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range xsd:decimal ;
    rdfs:label "Expected Revenue (amount * probability)" .

crm:closeDate a owl:DatatypeProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range xsd:date ;
    rdfs:label "Expected Close Date" .

crm:stage a owl:ObjectProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range crm:OpportunityStage ;
    rdfs:label "Current Stage" .

crm:account a owl:ObjectProperty ;
    rdfs:domain crm:Opportunity ;
    rdfs:range crm:Account ;
    rdfs:label "Associated Account" .

crm:owner a owl:ObjectProperty ;
    rdfs:range crm:SalesRep ;
    rdfs:label "Opportunity Owner" .

# ----------------------------------------------------------------------------
# Properties - Activities
# ----------------------------------------------------------------------------

crm:activityDate a owl:DatatypeProperty ;
    rdfs:domain crm:Activity ;
    rdfs:range xsd:dateTime ;
    rdfs:label "Activity Date" .

crm:subject a owl:DatatypeProperty ;
    rdfs:domain crm:Activity ;
    rdfs:range xsd:string ;
    rdfs:label "Subject" .

crm:description a owl:DatatypeProperty ;
    rdfs:range xsd:string ;
    rdfs:label "Description" .

crm:duration a owl:DatatypeProperty ;
    rdfs:domain crm:Activity ;
    rdfs:range xsd:integer ;
    rdfs:label "Duration (minutes)" .

crm:relatedTo a owl:ObjectProperty ;
    rdfs:domain crm:Activity ;
    rdfs:label "Related To (Account, Opportunity, etc.)" .

crm:assignedTo a owl:ObjectProperty ;
    rdfs:domain crm:Activity ;
    rdfs:range crm:SalesRep ;
    rdfs:label "Assigned To" .

crm:completed a owl:DatatypeProperty ;
    rdfs:domain crm:Activity ;
    rdfs:range xsd:boolean ;
    rdfs:label "Is Completed" .

# ----------------------------------------------------------------------------
# Properties - Leads
# ----------------------------------------------------------------------------

crm:leadId a owl:DatatypeProperty ;
    rdfs:domain crm:Lead ;
    rdfs:range xsd:string ;
    rdfs:label "Lead ID" .

crm:leadName a owl:DatatypeProperty ;
    rdfs:domain crm:Lead ;
    rdfs:range xsd:string ;
    rdfs:label "Lead Name" .

crm:company a owl:DatatypeProperty ;
    rdfs:domain crm:Lead ;
    rdfs:range xsd:string ;
    rdfs:label "Company Name" .

crm:leadSource a owl:ObjectProperty ;
    rdfs:domain crm:Lead ;
    rdfs:range crm:LeadSource ;
    rdfs:label "Lead Source" .

crm:leadStatus a owl:ObjectProperty ;
    rdfs:domain crm:Lead ;
    rdfs:range crm:LeadStatus ;
    rdfs:label "Lead Status" .

crm:leadScore a owl:ObjectProperty ;
    rdfs:domain crm:Lead ;
    rdfs:range crm:LeadScore ;
    rdfs:label "Lead Score" .

crm:scoreValue a owl:DatatypeProperty ;
    rdfs:domain crm:LeadScore ;
    rdfs:range xsd:integer ;
    rdfs:label "Score Value (0-100)" .

crm:convertedToAccount a owl:ObjectProperty ;
    rdfs:domain crm:Lead ;
    rdfs:range crm:Account ;
    rdfs:label "Converted to Account" .

# ----------------------------------------------------------------------------
# Properties - Campaigns
# ----------------------------------------------------------------------------

crm:campaignName a owl:DatatypeProperty ;
    rdfs:domain crm:Campaign ;
    rdfs:range xsd:string ;
    rdfs:label "Campaign Name" .

crm:startDate a owl:DatatypeProperty ;
    rdfs:range xsd:date ;
    rdfs:label "Start Date" .

crm:endDate a owl:DatatypeProperty ;
    rdfs:range xsd:date ;
    rdfs:label "End Date" .

crm:budget a owl:DatatypeProperty ;
    rdfs:domain crm:Campaign ;
    rdfs:range xsd:decimal ;
    rdfs:label "Campaign Budget" .

crm:actualCost a owl:DatatypeProperty ;
    rdfs:domain crm:Campaign ;
    rdfs:range xsd:decimal ;
    rdfs:label "Actual Cost" .

crm:targetAudience a owl:DatatypeProperty ;
    rdfs:domain crm:Campaign ;
    rdfs:range xsd:integer ;
    rdfs:label "Target Audience Size" .

crm:responseRate a owl:DatatypeProperty ;
    rdfs:domain crm:Campaign ;
    rdfs:range xsd:decimal ;
    rdfs:label "Response Rate" .

# ----------------------------------------------------------------------------
# Properties - Territory and Quota
# ----------------------------------------------------------------------------

crm:territoryName a owl:DatatypeProperty ;
    rdfs:domain crm:Territory ;
    rdfs:range xsd:string ;
    rdfs:label "Territory Name" .

crm:quotaAmount a owl:DatatypeProperty ;
    rdfs:domain crm:Quota ;
    rdfs:range xsd:decimal ;
    rdfs:label "Quota Amount" .

crm:quotaPeriod a owl:DatatypeProperty ;
    rdfs:domain crm:Quota ;
    rdfs:range xsd:string ;
    rdfs:label "Quota Period" .

crm:achievement a owl:DatatypeProperty ;
    rdfs:domain crm:Quota ;
    rdfs:range xsd:decimal ;
    rdfs:label "Quota Achievement %" .

# ----------------------------------------------------------------------------
# Lifecycle Stage Individuals
# ----------------------------------------------------------------------------

crm:Prospect a crm:LifecycleStage ;
    rdfs:label "Prospect" ;
    skos:prefLabel "Prospect" .

crm:QualifiedLead a crm:LifecycleStage ;
    rdfs:label "Qualified Lead" ;
    skos:prefLabel "Qualified Lead" .

crm:ActiveCustomer a crm:LifecycleStage ;
    rdfs:label "Active Customer" ;
    skos:prefLabel "Active Customer" .

crm:Advocate a crm:LifecycleStage ;
    rdfs:label "Advocate" ;
    skos:prefLabel "Advocate" .

# ----------------------------------------------------------------------------
# Opportunity Stage Individuals
# ----------------------------------------------------------------------------

crm:Prospecting a crm:OpportunityStage ;
    rdfs:label "Prospecting" ;
    crm:probability 10 ;
    skos:prefLabel "Prospecting" .

crm:Qualification a crm:OpportunityStage ;
    rdfs:label "Qualification" ;
    crm:probability 25 ;
    skos:prefLabel "Qualification" .

crm:NeedsAnalysis a crm:OpportunityStage ;
    rdfs:label "Needs Analysis" ;
    crm:probability 40 ;
    skos:prefLabel "Needs Analysis" .

crm:Proposal a crm:OpportunityStage ;
    rdfs:label "Proposal/Quotation" ;
    crm:probability 60 ;
    skos:prefLabel "Proposal" .

crm:Negotiation a crm:OpportunityStage ;
    rdfs:label "Negotiation" ;
    crm:probability 80 ;
    skos:prefLabel "Negotiation" .

crm:ClosedWon a crm:OpportunityStage ;
    rdfs:label "Closed Won" ;
    crm:probability 100 ;
    skos:prefLabel "Closed Won" .

crm:ClosedLost a crm:OpportunityStage ;
    rdfs:label "Closed Lost" ;
    crm:probability 0 ;
    skos:prefLabel "Closed Lost" .
