name: SobrietyGuard-macOS
options:
  bundleIdPrefix: com.neog
  deploymentTarget:
    macOS: "14.0"
  xcodeVersion: "15.0"
  createIntermediateGroups: true
  generateEmptyDirectories: true

settings:
  base:
    PRODUCT_NAME: SobrietyGuard
    MARKETING_VERSION: 1.0.0
    CURRENT_PROJECT_VERSION: 1
    SWIFT_VERSION: "5.9"
    ENABLE_HARDENED_RUNTIME: YES
    CODE_SIGN_STYLE: Manual
    DEVELOPMENT_TEAM: N3W33U35PP
    CODE_SIGN_IDENTITY: "Developer ID Application"
    INFOPLIST_KEY_NSHumanReadableCopyright: "Copyright 2024"
    INFOPLIST_KEY_LSApplicationCategoryType: "public.app-category.healthcare-fitness"
    INFOPLIST_KEY_LSUIElement: NO

targets:
  SobrietyGuard-macOS:
    type: application
    platform: macOS
    sources:
      - path: .
        excludes:
          - "*.md"
          - "*.yml"
          - "*.plist"
          - "Resources/Blocklists/**"
          - "LaunchAgent/**"
    resources:
      - path: Resources/Assets.xcassets
      - path: Resources/Blocklists
        buildPhase: resources
    settings:
      base:
        GENERATE_INFOPLIST_FILE: YES
        INFOPLIST_KEY_CFBundleDisplayName: SobrietyGuard
        INFOPLIST_KEY_NSPrincipalClass: NSApplication
        ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
        COMBINE_HIDPI_IMAGES: YES
        MACOSX_DEPLOYMENT_TARGET: "14.0"

        # Permissions
        INFOPLIST_KEY_NSAppleEventsUsageDescription: "SobrietyGuard needs automation access for monitoring."
        INFOPLIST_KEY_NSLocationWhenInUseUsageDescription: "SobrietyGuard uses location to detect risky environments."
        INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription: "SobrietyGuard monitors location patterns for your safety."

        # Entitlements
        CODE_SIGN_ENTITLEMENTS: SobrietyGuard.entitlements

    entitlements:
      path: SobrietyGuard.entitlements
      properties:
        com.apple.security.app-sandbox: false
        com.apple.security.network.client: true
        com.apple.security.automation.apple-events: true
        com.apple.security.files.user-selected.read-write: true
        com.apple.security.files.downloads.read-write: true

schemes:
  SobrietyGuard-macOS:
    build:
      targets:
        SobrietyGuard-macOS: all
    run:
      config: Debug
      commandLineArguments:
        "-ApplePersistenceIgnoreState": YES
    profile:
      config: Release
    analyze:
      config: Debug
    archive:
      config: Release
