{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/marsello/main/json-schema/marsello-customer-model-schema.json",
  "title": "CustomerModel",
  "description": "Customer get model",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/marsello-loyalty-api-v1.json#/components/schemas/CustomerModel",
  "type": "object",
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Customer Id"
    },
    "email": {
      "type": [
        "string",
        "null"
      ],
      "description": "Email"
    },
    "firstName": {
      "type": [
        "string",
        "null"
      ],
      "description": "First name"
    },
    "lastName": {
      "type": [
        "string",
        "null"
      ],
      "description": "Last name"
    },
    "phone": {
      "type": [
        "string",
        "null"
      ],
      "description": "Phone number"
    },
    "birthday": {
      "type": [
        "string",
        "null"
      ],
      "description": "Birthday",
      "format": "date-time"
    },
    "subscribed": {
      "type": "boolean",
      "description": "Subscribed to email marketing"
    },
    "requestSubscription": {
      "type": "boolean",
      "description": "If this customer should be asked to subscribe"
    },
    "subscribedSms": {
      "type": "boolean",
      "description": "Subscribed to sms marketing"
    },
    "subscribedNotifications": {
      "type": "boolean",
      "description": "Subscribed to transactional notifications"
    },
    "siteId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Site id the customer was created from"
    },
    "balance": {
      "type": "number",
      "description": "Customer balance",
      "format": "double"
    },
    "rewards": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/RewardModel"
      },
      "description": "All rewards available to this customer"
    },
    "verified": {
      "type": "boolean",
      "description": "Whether this user is verified or not"
    },
    "earnActivities": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/EarnActivityModel"
      },
      "description": "Activities this customer can perform in the loyalty program"
    },
    "referralLink": {
      "type": [
        "string",
        "null"
      ],
      "description": "Link used by this customer to refer their friends"
    },
    "gender": {
      "type": [
        "string",
        "null"
      ],
      "description": "Customer gender"
    },
    "tierName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The current tier for this customer"
    },
    "tierProgression": {
      "type": "number",
      "description": "Customers next tier progression",
      "format": "double"
    },
    "nextTierName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The next progressive tier name"
    },
    "nextTierThreshold": {
      "type": [
        "number",
        "null"
      ],
      "description": "The threshold value to the next tier",
      "format": "double"
    },
    "lastVisited": {
      "type": [
        "string",
        "null"
      ],
      "description": "Customer last purchased",
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "description": "Customer created at",
      "format": "date-time"
    },
    "customTags": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "Custom tags for the customer"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "ActivityType": {
      "enum": [
        "Undefined",
        "OrderOnline",
        "OrderInstore",
        "Order",
        "OrderRefund",
        "CouponReactivated",
        "ManualAdjustment",
        "Referral",
        "ClaimedReward",
        "RedeemedReward",
        "CreatedOffer",
        "ClaimedOffer",
        "RedeemedOffer",
        "FacebookShare",
        "TwitterShare",
        "ExpirePoints",
        "ApiAdjustment",
        "FacebookLike",
        "InstagramFollow",
        "TwitterFollow",
        "ProductReview",
        "Birthday",
        "CreatedAccount",
        "CancelledOrder",
        "CompletedProfile",
        "TierAssignment",
        "UnclaimCoupon",
        "DeletedCoupon",
        "RefundedCoupon",
        "TotalBalanceAdjustmentOnly",
        "PointsPromotion",
        "OrderUpdate",
        "InStoreVisit",
        "CustomEarnOptionManuallyFulfilled",
        "CustomEarnOptionApiFulfilled",
        "CustomerPortalEmailLogin",
        "UnknownMigrated",
        "CustomRewardFulfilled"
      ],
      "type": "string"
    },
    "ApiRewardType": {
      "enum": [
        "Reward",
        "Coupon"
      ],
      "type": "string"
    },
    "EarnActivityModel": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Unique string representing the specific earn activity"
        },
        "available": {
          "type": "boolean",
          "description": "Whether this earn activity is available to perform"
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Title of the earning activity"
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Description of this activity"
        },
        "points": {
          "type": "number",
          "description": "Points rewarded for this activity",
          "format": "double"
        },
        "lastRewarded": {
          "type": [
            "string",
            "null"
          ],
          "description": "The last time this earn activity was rewarded",
          "format": "date-time"
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional url to send the customer \r\nto this activity"
        },
        "threshold": {
          "type": "number",
          "description": "The number of units required to gain points",
          "format": "double"
        },
        "type": {
          "$ref": "#/$defs/ActivityType"
        }
      },
      "additionalProperties": false,
      "description": "Order get model"
    },
    "RewardModel": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Id of this reward"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the reward"
        },
        "points": {
          "type": "integer",
          "description": "Number of points required to claim this reward",
          "format": "int32"
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Description of the reward"
        },
        "expires": {
          "type": [
            "string",
            "null"
          ],
          "description": "Expiry",
          "format": "date-time"
        },
        "redeemCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "Code used to redeem this reward on the external system"
        },
        "fixedValue": {
          "type": [
            "number",
            "null"
          ],
          "description": "Dollar or Percent-Off value of the discount to be applied",
          "format": "double"
        },
        "minimumSpend": {
          "type": [
            "number",
            "null"
          ],
          "description": "The minimum dollar value required to allow this reward to be redeemed",
          "format": "double"
        },
        "discountType": {
          "type": [
            "string",
            "null"
          ],
          "description": "Discount type of the reward, dollar-off or percent-off"
        },
        "eligibleProducts": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          },
          "description": "The products that this discount can be applied to"
        },
        "eligibleCategories": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          },
          "description": "The categories this discount can be applied to"
        },
        "tierName": {
          "type": [
            "string",
            "null"
          ],
          "description": "The name of the associated tier"
        },
        "terms": {
          "type": [
            "string",
            "null"
          ],
          "description": "The terms of the reward"
        },
        "customRewardRedeemedFulfillmentMessage": {
          "type": [
            "string",
            "null"
          ],
          "description": "The fulfullment message if the reward is Custom"
        },
        "type": {
          "$ref": "#/$defs/ApiRewardType"
        }
      },
      "additionalProperties": false,
      "description": "Represents a reward available at a store"
    }
  }
}