{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/cosuno/main/json-schema/cosuno-bid-package-response-schema.json",
  "title": "BidPackageResponse",
  "x-generated": "2026-10-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cosuno-openapi.json#/components/schemas/BidPackageResponse",
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of the bid package.",
      "maxLength": 100
    },
    "number": {
      "type": [
        "string",
        "null"
      ],
      "description": "Internal bid package number or reference code used by your company.",
      "maxLength": 100
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Longer free-form description of the bid package, shared with invited subcontractors."
    },
    "budget": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "Budget allocated for this bid package, in the bid package's currency."
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Free-form internal notes about the bid package."
    },
    "id": {
      "type": "string",
      "description": "ID of the bid package."
    },
    "projectId": {
      "type": "string",
      "description": "ID of the project the bid package belongs to."
    },
    "status": {
      "$ref": "#/$defs/BID_PACKAGE_STATUS",
      "description": "Current lifecycle status of the bid package."
    },
    "currency": {
      "$ref": "#/$defs/CURRENCY",
      "description": "Currency used for all monetary values on this bid package."
    },
    "bidsDueAt": {
      "type": "string",
      "description": "Deadline by which subcontractors must submit their bids.\nThe date-time notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6)",
      "format": "date-time"
    },
    "bindingPeriod": {
      "type": "string",
      "description": "Date until which submitted bids remain binding on the subcontractor.",
      "format": "date"
    },
    "startsOn": {
      "type": "string",
      "description": "Planned start date of the work covered by this bid package.",
      "format": "date"
    },
    "endsOn": {
      "type": "string",
      "description": "Planned end date of the work covered by this bid package.",
      "format": "date"
    },
    "primaryUser": {
      "$ref": "#/$defs/UserResponse",
      "description": "Primary user in charge of the bid package."
    },
    "primaryContactUser": {
      "$ref": "#/$defs/UserResponse",
      "description": "User designated as the primary contact for subcontractors on the bid package. Defaults to the primary user if not set explicitly."
    },
    "bidPackageUsers": {
      "items": {
        "$ref": "#/$defs/BidPackageUserResponse"
      },
      "type": "array",
      "description": "Users assigned to the bid package with their roles."
    },
    "isBlindTender": {
      "type": "boolean",
      "description": "Whether the bid package is a blind tender — bids remain sealed until the opening date."
    },
    "openingDate": {
      "type": "string",
      "description": "Date at which bids will be unsealed, for blind tenders.",
      "format": "date"
    },
    "isMultiAwarding": {
      "type": "boolean",
      "description": "Whether multiple subcontractors can be awarded portions of this bid package."
    },
    "isPublishedOnMarketplace": {
      "type": "boolean",
      "description": "Whether the bid package is published on the Cosuno Marketplace, making it discoverable by subcontractors outside your own network."
    },
    "publishedAt": {
      "type": "string",
      "description": "Timestamp at which the bid package was published to subcontractors. Absent if the bid package has not yet been published.\nThe date-time notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6)",
      "format": "date-time"
    },
    "workCategories": {
      "items": {
        "$ref": "#/$defs/BidPackageWorkCategoryResponse"
      },
      "type": "array",
      "description": "Work categories assigned to the bid package."
    },
    "customFields": {
      "items": {
        "$ref": "#/$defs/MappedCustomField"
      },
      "type": "array",
      "description": "Values for the custom fields defined on bid packages in your company."
    }
  },
  "required": [
    "name",
    "id",
    "projectId",
    "status",
    "currency",
    "bidsDueAt",
    "bidPackageUsers",
    "isBlindTender",
    "isMultiAwarding",
    "isPublishedOnMarketplace",
    "workCategories"
  ],
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "BID_PACKAGE_STATUS": {
      "type": "string",
      "enum": [
        "draft",
        "published",
        "closed",
        "inNegotiation",
        "bidAwarded",
        "contractSigning",
        "contracted"
      ],
      "nullable": false
    },
    "BidPackageUserResponse": {
      "properties": {
        "userRole": {
          "type": "string",
          "description": "Role of the user on the bid package (e.g. bid package manager, team member). Accepted values depend on your company's configuration."
        },
        "isContactPerson": {
          "type": "boolean",
          "description": "Whether this user is designated as a contact person for subcontractors on the bid package."
        },
        "user": {
          "$ref": "#/$defs/UserResponse",
          "description": "The user assigned to the bid package."
        }
      },
      "required": [
        "userRole",
        "isContactPerson",
        "user"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "BidPackageWorkCategoryResponse": {
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the work category."
        },
        "name": {
          "type": "string",
          "description": "Name of the work category."
        }
      },
      "required": [
        "id",
        "name"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "CURRENCY": {
      "type": "string",
      "enum": [
        "EUR",
        "ALL",
        "AMD",
        "AZN",
        "BYN",
        "BAM",
        "BGN",
        "HRK",
        "CZK",
        "DKK",
        "GEL",
        "HUF",
        "ISK",
        "CHF",
        "MDL",
        "MKD",
        "NOK",
        "PLN",
        "RON",
        "RUB",
        "RSD",
        "SEK",
        "TRY",
        "UAH",
        "GBP"
      ],
      "nullable": false
    },
    "MappedCustomField": {
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number",
              "format": "double"
            },
            {
              "type": "boolean"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ],
          "nullable": true
        }
      },
      "required": [
        "id",
        "label"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "USER_STATUS": {
      "type": "string",
      "enum": [
        "approvalPending",
        "adminApprovalPending",
        "invited",
        "inviteCanceled",
        "inviteFailed",
        "inviteRequested",
        "active",
        "inactive"
      ],
      "nullable": false
    },
    "USER_TYPE": {
      "type": "string",
      "enum": [
        "custom",
        "administrator",
        "employee",
        "guest",
        "collaborator",
        "manager"
      ],
      "nullable": false
    },
    "UserResponse": {
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the user."
        },
        "email": {
          "type": "string",
          "description": "Email address of the user. Also used as their login identifier."
        },
        "status": {
          "$ref": "#/$defs/USER_STATUS",
          "description": "Current status of the user."
        },
        "firstName": {
          "type": "string",
          "description": "Given name of the user."
        },
        "lastName": {
          "type": "string",
          "description": "Family name of the user."
        },
        "type": {
          "$ref": "#/$defs/USER_TYPE",
          "description": "Account type of the user. Values starting with `custom` indicate a custom user role (see `customUserRoleId`)."
        },
        "customUserRoleId": {
          "type": "string",
          "description": "ID of the custom user role assigned to the user. Present only when `type` refers to a custom user role."
        }
      },
      "required": [
        "id",
        "email",
        "status",
        "type"
      ],
      "type": "object",
      "additionalProperties": false
    }
  }
}