# ----------------------------------------------------------
# LIST ALL (admin/debug)
# ----------------------------------------------------------
query listVendorBenefitPlans(
  $offset: Int
  $limit: Int
) @auth(level: USER) {
  vendorBenefitPlans(
    offset: $offset
    limit: $limit
  ) {
    id
    vendorId
    title
    description
    requestLabel
    total
    isActive
    createdAt
    updatedAt
    createdBy

    vendor {
      companyName
    }
  }
}

# ----------------------------------------------------------
# GET BY ID
# ----------------------------------------------------------
query getVendorBenefitPlanById($id: UUID!) @auth(level: USER) {
  vendorBenefitPlan(id: $id) {
    id
    vendorId
    title
    description
    requestLabel
    total
    isActive
    createdAt
    updatedAt
    createdBy

    vendor {
      companyName
    }
  }
}

# ----------------------------------------------------------
# LIST BY VENDOR
# ----------------------------------------------------------
query listVendorBenefitPlansByVendorId(
  $vendorId: UUID!
  $offset: Int
  $limit: Int
) @auth(level: USER) {
  vendorBenefitPlans(
    where: { vendorId: { eq: $vendorId } }
    offset: $offset
    limit: $limit
  ) {
    id
    vendorId
    title
    description
    requestLabel
    total
    isActive
    createdAt
    updatedAt
    createdBy

    vendor {
      companyName
    }
  }
}

# ----------------------------------------------------------
# LIST ACTIVE PLANS BY VENDOR
# ----------------------------------------------------------
query listActiveVendorBenefitPlansByVendorId(
  $vendorId: UUID!
  $offset: Int
  $limit: Int
) @auth(level: USER) {
  vendorBenefitPlans(
    where: {
      vendorId: { eq: $vendorId }
      isActive: { eq: true }
    }
    offset: $offset
    limit: $limit
  ) {
    id
    vendorId
    title
    description
    requestLabel
    total
    isActive
    createdAt
    updatedAt
    createdBy

    vendor {
      companyName
    }
  }
}

# ----------------------------------------------------------
# FILTER (vendorId + title + isActive)
# - Useful for "does this plan already exist?"
# ----------------------------------------------------------
query filterVendorBenefitPlans(
  $vendorId: UUID
  $title: String
  $isActive: Boolean
  $offset: Int
  $limit: Int
) @auth(level: USER) {
  vendorBenefitPlans(
    where: {
      vendorId: { eq: $vendorId }
      title: { eq: $title }
      isActive: { eq: $isActive }
    }
    offset: $offset
    limit: $limit
  ) {
    id
    vendorId
    title
    description
    requestLabel
    total
    isActive
    createdAt
    updatedAt
    createdBy

    vendor {
      companyName
    }
  }
}
