/**
 * Non-Profit Domain Template
 *
 * A comprehensive non-profit data domain following domain-driven design principles.
 * This template covers the complete non-profit organization lifecycle including:
 *
 * - Donor Management: Donors, donations, campaigns, stewardship
 * - Program Management: Programs, services, outcomes, impact
 * - Volunteer Management: Volunteers, opportunities, scheduling
 * - Grant Management: Grants, applications, reporting, compliance
 * - Event Management: Fundraising events, registrations, logistics
 * - Financial Management: Budgets, expenses, reporting
 *
 * Key Features:
 * - Complete donor lifecycle management
 * - Program and service delivery tracking
 * - Volunteer coordination and scheduling
 * - Grant application and compliance management
 * - Event planning and fundraising
 * - Financial management and reporting
 * - Impact measurement and outcomes
 *
 * Use Cases:
 * - Non-profit organizations
 * - Charitable foundations
 * - Community service organizations
 * - Donor relationship management
 * - Volunteer coordination
 * - Grant management
 * - Fundraising and events
 */
import { DataDomain } from '../../../DataDomain.js';
import { addIdField, addNameField, addDescriptionField, addEmailField, addPhoneField, addCustomStatusField, addCreatedAtField, addUpdatedAtField, addCurrencyAmountField, } from '../../../helpers/Intelisense.js';
function createDomain() {
    return new DataDomain({
        info: {
            name: 'Non-Profit Platform',
            displayName: 'Non-Profit Platform',
            description: 'A comprehensive non-profit platform with donor management, programs, volunteers, ' +
                'grants, events, and financial management',
        },
    });
}
/**
 * Creates a comprehensive non-profit data domain following domain-driven design principles.
 *
 * This function demonstrates the proper hierarchy and organization for a non-profit platform:
 * 1. Creates the root DataDomain for the non-profit platform
 * 2. Organizes functionality into logical namespaces (Donor Management, Program Management, etc.)
 * 3. Groups related entities into models within each namespace
 * 4. Defines entities with proper semantic annotations for non-profit workflows
 * 5. Establishes associations with appropriate cardinality for non-profit relationships
 *
 * @returns A fully configured DataDomain with all non-profit entities and relationships
 */
export default function createNonProfitDomain(options = {}) {
    // Ensure the root data domain
    const domain = options.domain ?? createDomain();
    //
    // 1. DONOR MANAGEMENT NAMESPACE
    //
    const donorManagement = domain.addNamespace({
        info: {
            name: 'DonorManagement',
            displayName: 'Donor Management',
            description: 'Donors, donations, campaigns, and stewardship',
        },
    });
    // Donor Model
    const donorModel = donorManagement.addModel({
        info: {
            name: 'Donors',
            displayName: 'Donor Management',
            description: 'Donor profiles and relationships',
        },
    });
    // Donor Entity
    const donorEntity = donorModel.addEntity({
        info: {
            name: 'donor',
            displayName: 'Donor',
            description: 'Donor with profile and giving history',
        },
    });
    addIdField(donorEntity, { displayName: 'Donor ID', description: 'Unique identifier for the donor' });
    addNameField(donorEntity, { description: 'Donor name and title' });
    addDescriptionField(donorEntity, { description: 'Donor description and notes' });
    addEmailField(donorEntity, { description: 'Donor email address' });
    addPhoneField(donorEntity, { description: 'Donor phone number' });
    donorEntity.addProperty({
        info: { name: 'donor_type', displayName: 'Donor Type', description: 'Type of donor' },
        type: 'string',
        required: true,
        schema: {
            enum: ['individual', 'corporation', 'foundation', 'government', 'anonymous'],
        },
    });
    donorEntity.addProperty({
        info: { name: 'address', displayName: 'Address', description: 'Donor address' },
        type: 'string',
        required: false,
    });
    donorEntity.addProperty({
        info: { name: 'date_of_birth', displayName: 'Date of Birth', description: 'Donor date of birth' },
        type: 'date',
        required: false,
    });
    donorEntity.addProperty({
        info: { name: 'employer', displayName: 'Employer', description: 'Donor employer' },
        type: 'string',
        required: false,
    });
    addCustomStatusField(donorEntity, ['active', 'inactive', 'prospect', 'lapsed'], {
        displayName: 'Donor Status',
        description: 'Current status of the donor',
    });
    addCreatedAtField(donorEntity, { description: 'When the donor record was created' });
    addUpdatedAtField(donorEntity, { description: 'When the donor record was last updated' });
    // Donation Entity
    const donationEntity = donorModel.addEntity({
        info: {
            name: 'donation',
            displayName: 'Donation',
            description: 'Donor contribution',
        },
    });
    addIdField(donationEntity, { displayName: 'Donation ID', description: 'Unique identifier for the donation' });
    addNameField(donationEntity, { description: 'Donation name and description' });
    addDescriptionField(donationEntity, { description: 'Donation description and purpose' });
    donationEntity.addProperty({
        info: { name: 'donation_date', displayName: 'Donation Date', description: 'Date of the donation' },
        type: 'date',
        required: true,
    });
    donationEntity.addProperty({
        info: { name: 'donation_type', displayName: 'Donation Type', description: 'Type of donation' },
        type: 'string',
        required: true,
        schema: {
            enum: ['one_time', 'recurring', 'pledge', 'in_kind', 'matching'],
        },
    });
    donationEntity.addProperty({
        info: { name: 'payment_method', displayName: 'Payment Method', description: 'Payment method used' },
        type: 'string',
        required: true,
        schema: {
            enum: ['check', 'credit_card', 'bank_transfer', 'cash', 'online', 'stock'],
        },
    });
    addCurrencyAmountField(donationEntity, 'amount', 'Donation Amount', {
        description: 'Donation amount',
    });
    addCustomStatusField(donationEntity, ['pending', 'received', 'acknowledged', 'thanked'], {
        displayName: 'Donation Status',
        description: 'Current status of the donation',
    });
    addCreatedAtField(donationEntity, { description: 'When the donation was created' });
    // Donation-Donor Association (Many-to-One)
    donationEntity.addAssociation({ key: donorEntity.key }, {
        info: { name: 'donor', displayName: 'Donor', description: 'Donor for this donation' },
        required: true,
        multiple: false,
    });
    // Campaign Entity
    const campaignEntity = donorModel.addEntity({
        info: {
            name: 'campaign',
            displayName: 'Campaign',
            description: 'Fundraising campaign',
        },
    });
    addIdField(campaignEntity, { displayName: 'Campaign ID', description: 'Unique identifier for the campaign' });
    addNameField(campaignEntity, { description: 'Campaign name and title' });
    addDescriptionField(campaignEntity, { description: 'Campaign description and goals' });
    campaignEntity.addProperty({
        info: { name: 'campaign_type', displayName: 'Campaign Type', description: 'Type of campaign' },
        type: 'string',
        required: true,
        schema: {
            enum: ['annual', 'capital', 'emergency', 'special_event', 'online', 'mail'],
        },
    });
    campaignEntity.addProperty({
        info: { name: 'start_date', displayName: 'Start Date', description: 'Campaign start date' },
        type: 'date',
        required: true,
    });
    campaignEntity.addProperty({
        info: { name: 'end_date', displayName: 'End Date', description: 'Campaign end date' },
        type: 'date',
        required: true,
    });
    addCurrencyAmountField(campaignEntity, 'goal_amount', 'Goal Amount', {
        description: 'Campaign fundraising goal',
    });
    addCurrencyAmountField(campaignEntity, 'raised_amount', 'Raised Amount', {
        description: 'Amount raised so far',
    });
    addCustomStatusField(campaignEntity, ['planning', 'active', 'completed', 'cancelled'], {
        displayName: 'Campaign Status',
        description: 'Current status of the campaign',
    });
    addCreatedAtField(campaignEntity, { description: 'When the campaign was created' });
    // Donation-Campaign Association (Many-to-One)
    donationEntity.addAssociation({ key: campaignEntity.key }, {
        info: { name: 'campaign', displayName: 'Campaign', description: 'Campaign for this donation' },
        required: false,
        multiple: false,
    });
    //
    // 2. PROGRAM MANAGEMENT NAMESPACE
    //
    const programManagement = domain.addNamespace({
        info: {
            name: 'ProgramManagement',
            displayName: 'Program Management',
            description: 'Programs, services, outcomes, and impact',
        },
    });
    // Program Model
    const programModel = programManagement.addModel({
        info: {
            name: 'Programs',
            displayName: 'Program Management',
            description: 'Programs and services',
        },
    });
    // Program Entity
    const programEntity = programModel.addEntity({
        info: {
            name: 'program',
            displayName: 'Program',
            description: 'Non-profit program or service',
        },
    });
    addIdField(programEntity, { displayName: 'Program ID', description: 'Unique identifier for the program' });
    addNameField(programEntity, { description: 'Program name and title' });
    addDescriptionField(programEntity, { description: 'Program description and objectives' });
    programEntity.addProperty({
        info: { name: 'program_type', displayName: 'Program Type', description: 'Type of program' },
        type: 'string',
        required: true,
        schema: {
            enum: ['education', 'healthcare', 'social_services', 'environmental', 'arts_culture', 'community_development'],
        },
    });
    programEntity.addProperty({
        info: { name: 'start_date', displayName: 'Start Date', description: 'Program start date' },
        type: 'date',
        required: true,
    });
    programEntity.addProperty({
        info: { name: 'end_date', displayName: 'End Date', description: 'Program end date' },
        type: 'date',
        required: false,
    });
    addCurrencyAmountField(programEntity, 'budget', 'Program Budget', {
        description: 'Program budget amount',
    });
    programEntity.addProperty({
        info: { name: 'target_population', displayName: 'Target Population', description: 'Target population served' },
        type: 'string',
        required: false,
    });
    addCustomStatusField(programEntity, ['planning', 'active', 'completed', 'suspended'], {
        displayName: 'Program Status',
        description: 'Current status of the program',
    });
    addCreatedAtField(programEntity, { description: 'When the program was created' });
    addUpdatedAtField(programEntity, { description: 'When the program was last updated' });
    // Service Entity
    const serviceEntity = programModel.addEntity({
        info: {
            name: 'service',
            displayName: 'Service',
            description: 'Service provided by the program',
        },
    });
    addIdField(serviceEntity, { displayName: 'Service ID', description: 'Unique identifier for the service' });
    addNameField(serviceEntity, { description: 'Service name and title' });
    addDescriptionField(serviceEntity, { description: 'Service description and details' });
    serviceEntity.addProperty({
        info: { name: 'service_type', displayName: 'Service Type', description: 'Type of service' },
        type: 'string',
        required: true,
        schema: {
            enum: ['direct_service', 'referral', 'advocacy', 'education', 'support', 'counseling'],
        },
    });
    serviceEntity.addProperty({
        info: { name: 'location', displayName: 'Location', description: 'Service location' },
        type: 'string',
        required: false,
    });
    addCustomStatusField(serviceEntity, ['available', 'unavailable', 'waitlist'], {
        displayName: 'Service Status',
        description: 'Current status of the service',
    });
    addCreatedAtField(serviceEntity, { description: 'When the service was created' });
    // Service-Program Association (Many-to-One)
    serviceEntity.addAssociation({ key: programEntity.key }, {
        info: { name: 'program', displayName: 'Program', description: 'Program for this service' },
        required: true,
        multiple: false,
    });
    // Outcome Entity
    const outcomeEntity = programModel.addEntity({
        info: {
            name: 'outcome',
            displayName: 'Outcome',
            description: 'Program outcomes and impact measurement',
        },
    });
    addIdField(outcomeEntity, { displayName: 'Outcome ID', description: 'Unique identifier for the outcome' });
    addNameField(outcomeEntity, { description: 'Outcome name and description' });
    addDescriptionField(outcomeEntity, { description: 'Outcome description and measurement' });
    outcomeEntity.addProperty({
        info: { name: 'outcome_type', displayName: 'Outcome Type', description: 'Type of outcome' },
        type: 'string',
        required: true,
        schema: {
            enum: ['short_term', 'medium_term', 'long_term', 'impact', 'output'],
        },
    });
    outcomeEntity.addProperty({
        info: { name: 'measurement_unit', displayName: 'Measurement Unit', description: 'Unit of measurement' },
        type: 'string',
        required: true,
    });
    outcomeEntity.addProperty({
        info: { name: 'target_value', displayName: 'Target Value', description: 'Target outcome value' },
        type: 'number',
        required: true,
    });
    outcomeEntity.addProperty({
        info: { name: 'actual_value', displayName: 'Actual Value', description: 'Actual outcome value' },
        type: 'number',
        required: false,
    });
    addCustomStatusField(outcomeEntity, ['planned', 'in_progress', 'achieved', 'not_achieved'], {
        displayName: 'Outcome Status',
        description: 'Current status of the outcome',
    });
    addCreatedAtField(outcomeEntity, { description: 'When the outcome was created' });
    // Outcome-Program Association (Many-to-One)
    outcomeEntity.addAssociation({ key: programEntity.key }, {
        info: { name: 'program', displayName: 'Program', description: 'Program for this outcome' },
        required: true,
        multiple: false,
    });
    //
    // 3. VOLUNTEER MANAGEMENT NAMESPACE
    //
    const volunteerManagement = domain.addNamespace({
        info: {
            name: 'VolunteerManagement',
            displayName: 'Volunteer Management',
            description: 'Volunteers, opportunities, and scheduling',
        },
    });
    // Volunteer Model
    const volunteerModel = volunteerManagement.addModel({
        info: {
            name: 'Volunteers',
            displayName: 'Volunteer Management',
            description: 'Volunteer profiles and opportunities',
        },
    });
    // Volunteer Entity
    const volunteerEntity = volunteerModel.addEntity({
        info: {
            name: 'volunteer',
            displayName: 'Volunteer',
            description: 'Volunteer with profile and skills',
        },
    });
    addIdField(volunteerEntity, { displayName: 'Volunteer ID', description: 'Unique identifier for the volunteer' });
    addNameField(volunteerEntity, { description: 'Volunteer name and title' });
    addDescriptionField(volunteerEntity, { description: 'Volunteer description and notes' });
    addEmailField(volunteerEntity, { description: 'Volunteer email address' });
    addPhoneField(volunteerEntity, { description: 'Volunteer phone number' });
    volunteerEntity.addProperty({
        info: { name: 'volunteer_type', displayName: 'Volunteer Type', description: 'Type of volunteer' },
        type: 'string',
        required: true,
        schema: {
            enum: ['individual', 'corporate', 'student', 'retired', 'professional'],
        },
    });
    volunteerEntity.addProperty({
        info: { name: 'skills', displayName: 'Skills', description: 'Volunteer skills and expertise' },
        type: 'string',
        required: false,
    });
    volunteerEntity.addProperty({
        info: { name: 'availability', displayName: 'Availability', description: 'Volunteer availability' },
        type: 'string',
        required: false,
    });
    addCustomStatusField(volunteerEntity, ['active', 'inactive', 'pending', 'suspended'], {
        displayName: 'Volunteer Status',
        description: 'Current status of the volunteer',
    });
    addCreatedAtField(volunteerEntity, { description: 'When the volunteer record was created' });
    addUpdatedAtField(volunteerEntity, { description: 'When the volunteer record was last updated' });
    // Opportunity Entity
    const opportunityEntity = volunteerModel.addEntity({
        info: {
            name: 'opportunity',
            displayName: 'Opportunity',
            description: 'Volunteer opportunity',
        },
    });
    addIdField(opportunityEntity, {
        displayName: 'Opportunity ID',
        description: 'Unique identifier for the opportunity',
    });
    addNameField(opportunityEntity, { description: 'Opportunity name and title' });
    addDescriptionField(opportunityEntity, { description: 'Opportunity description and requirements' });
    opportunityEntity.addProperty({
        info: { name: 'opportunity_type', displayName: 'Opportunity Type', description: 'Type of opportunity' },
        type: 'string',
        required: true,
        schema: {
            enum: ['event_support', 'program_delivery', 'administrative', 'fundraising', 'mentoring', 'outreach'],
        },
    });
    opportunityEntity.addProperty({
        info: { name: 'location', displayName: 'Location', description: 'Opportunity location' },
        type: 'string',
        required: false,
    });
    opportunityEntity.addProperty({
        info: { name: 'required_skills', displayName: 'Required Skills', description: 'Skills required for opportunity' },
        type: 'string',
        required: false,
    });
    opportunityEntity.addProperty({
        info: { name: 'duration', displayName: 'Duration', description: 'Opportunity duration' },
        type: 'string',
        required: false,
    });
    addCustomStatusField(opportunityEntity, ['open', 'filled', 'closed', 'cancelled'], {
        displayName: 'Opportunity Status',
        description: 'Current status of the opportunity',
    });
    addCreatedAtField(opportunityEntity, { description: 'When the opportunity was created' });
    // Opportunity-Program Association (Many-to-One)
    opportunityEntity.addAssociation({ key: programEntity.key }, {
        info: { name: 'program', displayName: 'Program', description: 'Program for this opportunity' },
        required: false,
        multiple: false,
    });
    // Volunteer Assignment Entity
    const volunteerAssignmentEntity = volunteerModel.addEntity({
        info: {
            name: 'volunteer_assignment',
            displayName: 'Volunteer Assignment',
            description: 'Volunteer assignments and scheduling',
        },
    });
    addIdField(volunteerAssignmentEntity, {
        displayName: 'Assignment ID',
        description: 'Unique identifier for the volunteer assignment',
    });
    addNameField(volunteerAssignmentEntity, { description: 'Assignment name and description' });
    volunteerAssignmentEntity.addProperty({
        info: { name: 'assignment_date', displayName: 'Assignment Date', description: 'Assignment date' },
        type: 'date',
        required: true,
    });
    volunteerAssignmentEntity.addProperty({
        info: { name: 'start_time', displayName: 'Start Time', description: 'Assignment start time' },
        type: 'time',
        required: true,
    });
    volunteerAssignmentEntity.addProperty({
        info: { name: 'end_time', displayName: 'End Time', description: 'Assignment end time' },
        type: 'time',
        required: true,
    });
    volunteerAssignmentEntity.addProperty({
        info: { name: 'hours_worked', displayName: 'Hours Worked', description: 'Hours worked on assignment' },
        type: 'number',
        required: false,
        schema: {
            minimum: 0,
        },
    });
    addCustomStatusField(volunteerAssignmentEntity, ['scheduled', 'in_progress', 'completed', 'cancelled'], {
        displayName: 'Assignment Status',
        description: 'Current status of the volunteer assignment',
    });
    addCreatedAtField(volunteerAssignmentEntity, { description: 'When the assignment was created' });
    // VolunteerAssignment-Volunteer Association (Many-to-One)
    volunteerAssignmentEntity.addAssociation({ key: volunteerEntity.key }, {
        info: { name: 'volunteer', displayName: 'Volunteer', description: 'Volunteer for this assignment' },
        required: true,
        multiple: false,
    });
    // VolunteerAssignment-Opportunity Association (Many-to-One)
    volunteerAssignmentEntity.addAssociation({ key: opportunityEntity.key }, {
        info: { name: 'opportunity', displayName: 'Opportunity', description: 'Opportunity for this assignment' },
        required: true,
        multiple: false,
    });
    //
    // 4. GRANT MANAGEMENT NAMESPACE
    //
    const grantManagement = domain.addNamespace({
        info: {
            name: 'GrantManagement',
            displayName: 'Grant Management',
            description: 'Grants, applications, reporting, and compliance',
        },
    });
    // Grant Model
    const grantModel = grantManagement.addModel({
        info: {
            name: 'Grants',
            displayName: 'Grant Management',
            description: 'Grant applications and management',
        },
    });
    // Grant Entity
    const grantEntity = grantModel.addEntity({
        info: {
            name: 'grant',
            displayName: 'Grant',
            description: 'Grant application or award',
        },
    });
    addIdField(grantEntity, { displayName: 'Grant ID', description: 'Unique identifier for the grant' });
    addNameField(grantEntity, { description: 'Grant name and title' });
    addDescriptionField(grantEntity, { description: 'Grant description and objectives' });
    grantEntity.addProperty({
        info: { name: 'grant_type', displayName: 'Grant Type', description: 'Type of grant' },
        type: 'string',
        required: true,
        schema: {
            enum: ['program', 'operating', 'capital', 'research', 'emergency', 'matching'],
        },
    });
    grantEntity.addProperty({
        info: { name: 'funder', displayName: 'Funder', description: 'Grant funder or foundation' },
        type: 'string',
        required: true,
    });
    grantEntity.addProperty({
        info: { name: 'application_date', displayName: 'Application Date', description: 'Grant application date' },
        type: 'date',
        required: true,
    });
    grantEntity.addProperty({
        info: { name: 'decision_date', displayName: 'Decision Date', description: 'Grant decision date' },
        type: 'date',
        required: false,
    });
    addCurrencyAmountField(grantEntity, 'requested_amount', 'Requested Amount', {
        description: 'Amount requested in grant',
    });
    addCurrencyAmountField(grantEntity, 'awarded_amount', 'Awarded Amount', {
        description: 'Amount awarded in grant',
    });
    addCustomStatusField(grantEntity, ['draft', 'submitted', 'under_review', 'approved', 'rejected', 'active', 'completed'], {
        displayName: 'Grant Status',
        description: 'Current status of the grant',
    });
    addCreatedAtField(grantEntity, { description: 'When the grant was created' });
    // Grant-Program Association (Many-to-One)
    grantEntity.addAssociation({ key: programEntity.key }, {
        info: { name: 'program', displayName: 'Program', description: 'Program for this grant' },
        required: true,
        multiple: false,
    });
    // Grant Report Entity
    const grantReportEntity = grantModel.addEntity({
        info: {
            name: 'grant_report',
            displayName: 'Grant Report',
            description: 'Grant reporting and compliance',
        },
    });
    addIdField(grantReportEntity, {
        displayName: 'Report ID',
        description: 'Unique identifier for the grant report',
    });
    addNameField(grantReportEntity, { description: 'Report name and title' });
    addDescriptionField(grantReportEntity, { description: 'Report description and content' });
    grantReportEntity.addProperty({
        info: { name: 'report_type', displayName: 'Report Type', description: 'Type of grant report' },
        type: 'string',
        required: true,
        schema: {
            enum: ['progress', 'final', 'financial', 'narrative', 'compliance'],
        },
    });
    grantReportEntity.addProperty({
        info: { name: 'due_date', displayName: 'Due Date', description: 'Report due date' },
        type: 'date',
        required: true,
    });
    grantReportEntity.addProperty({
        info: { name: 'submission_date', displayName: 'Submission Date', description: 'Report submission date' },
        type: 'date',
        required: false,
    });
    addCustomStatusField(grantReportEntity, ['draft', 'submitted', 'approved', 'revision_requested'], {
        displayName: 'Report Status',
        description: 'Current status of the grant report',
    });
    addCreatedAtField(grantReportEntity, { description: 'When the report was created' });
    // GrantReport-Grant Association (Many-to-One)
    grantReportEntity.addAssociation({ key: grantEntity.key }, {
        info: { name: 'grant', displayName: 'Grant', description: 'Grant for this report' },
        required: true,
        multiple: false,
    });
    //
    // 5. EVENT MANAGEMENT NAMESPACE
    //
    const eventManagement = domain.addNamespace({
        info: {
            name: 'EventManagement',
            displayName: 'Event Management',
            description: 'Fundraising events, registrations, and logistics',
        },
    });
    // Event Model
    const eventModel = eventManagement.addModel({
        info: {
            name: 'Events',
            displayName: 'Event Management',
            description: 'Fundraising events and activities',
        },
    });
    // Event Entity
    const eventEntity = eventModel.addEntity({
        info: {
            name: 'event',
            displayName: 'Event',
            description: 'Fundraising event or activity',
        },
    });
    addIdField(eventEntity, { displayName: 'Event ID', description: 'Unique identifier for the event' });
    addNameField(eventEntity, { description: 'Event name and title' });
    addDescriptionField(eventEntity, { description: 'Event description and details' });
    eventEntity.addProperty({
        info: { name: 'event_type', displayName: 'Event Type', description: 'Type of event' },
        type: 'string',
        required: true,
        schema: {
            enum: ['gala', 'auction', 'walk_run', 'golf_tournament', 'conference', 'workshop', 'volunteer_day'],
        },
    });
    eventEntity.addProperty({
        info: { name: 'event_date', displayName: 'Event Date', description: 'Event date' },
        type: 'date',
        required: true,
    });
    eventEntity.addProperty({
        info: { name: 'start_time', displayName: 'Start Time', description: 'Event start time' },
        type: 'time',
        required: true,
    });
    eventEntity.addProperty({
        info: { name: 'end_time', displayName: 'End Time', description: 'Event end time' },
        type: 'time',
        required: false,
    });
    eventEntity.addProperty({
        info: { name: 'location', displayName: 'Location', description: 'Event location' },
        type: 'string',
        required: true,
    });
    eventEntity.addProperty({
        info: { name: 'capacity', displayName: 'Capacity', description: 'Event capacity' },
        type: 'number',
        required: false,
        schema: {
            minimum: 1,
        },
    });
    addCurrencyAmountField(eventEntity, 'goal_amount', 'Goal Amount', {
        description: 'Event fundraising goal',
    });
    addCurrencyAmountField(eventEntity, 'raised_amount', 'Raised Amount', {
        description: 'Amount raised from event',
    });
    addCustomStatusField(eventEntity, ['planning', 'registration_open', 'registration_closed', 'in_progress', 'completed', 'cancelled'], {
        displayName: 'Event Status',
        description: 'Current status of the event',
    });
    addCreatedAtField(eventEntity, { description: 'When the event was created' });
    // Registration Entity
    const registrationEntity = eventModel.addEntity({
        info: {
            name: 'registration',
            displayName: 'Registration',
            description: 'Event registration',
        },
    });
    addIdField(registrationEntity, {
        displayName: 'Registration ID',
        description: 'Unique identifier for the registration',
    });
    addNameField(registrationEntity, { description: 'Registration name and description' });
    registrationEntity.addProperty({
        info: { name: 'registration_date', displayName: 'Registration Date', description: 'Registration date' },
        type: 'date',
        required: true,
    });
    registrationEntity.addProperty({
        info: { name: 'registration_type', displayName: 'Registration Type', description: 'Type of registration' },
        type: 'string',
        required: true,
        schema: {
            enum: ['individual', 'group', 'sponsor', 'volunteer'],
        },
    });
    registrationEntity.addProperty({
        info: { name: 'number_of_attendees', displayName: 'Number of Attendees', description: 'Number of attendees' },
        type: 'number',
        required: true,
        schema: {
            minimum: 1,
        },
    });
    addCurrencyAmountField(registrationEntity, 'registration_fee', 'Registration Fee', {
        description: 'Registration fee amount',
    });
    addCustomStatusField(registrationEntity, ['pending', 'confirmed', 'cancelled', 'attended'], {
        displayName: 'Registration Status',
        description: 'Current status of the registration',
    });
    addCreatedAtField(registrationEntity, { description: 'When the registration was created' });
    // Registration-Event Association (Many-to-One)
    registrationEntity.addAssociation({ key: eventEntity.key }, {
        info: { name: 'event', displayName: 'Event', description: 'Event for this registration' },
        required: true,
        multiple: false,
    });
    // Registration-Donor Association (Many-to-One)
    registrationEntity.addAssociation({ key: donorEntity.key }, {
        info: { name: 'donor', displayName: 'Donor', description: 'Donor for this registration' },
        required: true,
        multiple: false,
    });
    //
    // 6. FINANCIAL MANAGEMENT NAMESPACE
    //
    const financialManagement = domain.addNamespace({
        info: {
            name: 'FinancialManagement',
            displayName: 'Financial Management',
            description: 'Budgets, expenses, and reporting',
        },
    });
    // Financial Model
    const financialModel = financialManagement.addModel({
        info: {
            name: 'Financial',
            displayName: 'Financial Management',
            description: 'Financial management and reporting',
        },
    });
    // Budget Entity
    const budgetEntity = financialModel.addEntity({
        info: {
            name: 'budget',
            displayName: 'Budget',
            description: 'Organization budget',
        },
    });
    addIdField(budgetEntity, { displayName: 'Budget ID', description: 'Unique identifier for the budget' });
    addNameField(budgetEntity, { description: 'Budget name and description' });
    addDescriptionField(budgetEntity, { description: 'Budget description and notes' });
    budgetEntity.addProperty({
        info: { name: 'budget_type', displayName: 'Budget Type', description: 'Type of budget' },
        type: 'string',
        required: true,
        schema: {
            enum: ['operating', 'program', 'capital', 'project', 'department'],
        },
    });
    budgetEntity.addProperty({
        info: { name: 'fiscal_year', displayName: 'Fiscal Year', description: 'Budget fiscal year' },
        type: 'string',
        required: true,
    });
    budgetEntity.addProperty({
        info: { name: 'start_date', displayName: 'Start Date', description: 'Budget start date' },
        type: 'date',
        required: true,
    });
    budgetEntity.addProperty({
        info: { name: 'end_date', displayName: 'End Date', description: 'Budget end date' },
        type: 'date',
        required: true,
    });
    addCurrencyAmountField(budgetEntity, 'total_budget', 'Total Budget', {
        description: 'Total budget amount',
    });
    addCurrencyAmountField(budgetEntity, 'spent_amount', 'Spent Amount', {
        description: 'Amount spent so far',
    });
    addCustomStatusField(budgetEntity, ['draft', 'approved', 'active', 'closed'], {
        displayName: 'Budget Status',
        description: 'Current status of the budget',
    });
    addCreatedAtField(budgetEntity, { description: 'When the budget was created' });
    // Budget-Program Association (Many-to-One)
    budgetEntity.addAssociation({ key: programEntity.key }, {
        info: { name: 'program', displayName: 'Program', description: 'Program for this budget' },
        required: false,
        multiple: false,
    });
    // Expense Entity
    const expenseEntity = financialModel.addEntity({
        info: {
            name: 'expense',
            displayName: 'Expense',
            description: 'Organization expense',
        },
    });
    addIdField(expenseEntity, { displayName: 'Expense ID', description: 'Unique identifier for the expense' });
    addNameField(expenseEntity, { description: 'Expense name and description' });
    addDescriptionField(expenseEntity, { description: 'Expense description and details' });
    expenseEntity.addProperty({
        info: { name: 'expense_type', displayName: 'Expense Type', description: 'Type of expense' },
        type: 'string',
        required: true,
        schema: {
            enum: ['personnel', 'program', 'administrative', 'fundraising', 'facilities', 'equipment'],
        },
    });
    expenseEntity.addProperty({
        info: { name: 'expense_date', displayName: 'Expense Date', description: 'Expense date' },
        type: 'date',
        required: true,
    });
    expenseEntity.addProperty({
        info: { name: 'vendor', displayName: 'Vendor', description: 'Expense vendor' },
        type: 'string',
        required: false,
    });
    addCurrencyAmountField(expenseEntity, 'amount', 'Expense Amount', {
        description: 'Expense amount',
    });
    addCustomStatusField(expenseEntity, ['pending', 'approved', 'paid', 'rejected'], {
        displayName: 'Expense Status',
        description: 'Current status of the expense',
    });
    addCreatedAtField(expenseEntity, { description: 'When the expense was created' });
    // Expense-Budget Association (Many-to-One)
    expenseEntity.addAssociation({ key: budgetEntity.key }, {
        info: { name: 'budget', displayName: 'Budget', description: 'Budget for this expense' },
        required: true,
        multiple: false,
    });
    return domain;
}
//# sourceMappingURL=non-profit-domain.js.map