openapi: "3.0.3"
info:
  title: "HR directory API"
  version: "1.0.0"
  description: "Departments are the parent of employees, and the cost centre code is unique per department in the source system. The salary column carries a zero allowed so that an intern row can be inserted with no salary. The hired_on column is a date, not a timestamp, and Postgres rejects a timestamp string written into it without a cast. A fixture of this shape is exactly what an employee directory endpoint returns."
paths: {}
x-domain-id: "hr"
x-dialect: "postgres"
components:
  schemas:
    departments:
      type: "object"
      x-primary-key: "id"
      required: ["id", "name", "cost_center"]
      properties:
        id:
          type: "integer"
        name:
          type: "string"
          x-unique: true
        cost_center:
          type: "string"
    employees:
      type: "object"
      x-primary-key: "id"
      required: ["id", "department_id", "email", "full_name", "hired_on", "salary_cents"]
      properties:
        id:
          type: "integer"
        department_id:
          $ref: "#/components/schemas/departments"
        email:
          type: "string"
          format: "email"
          x-unique: true
        full_name:
          type: "string"
        hired_on:
          type: "string"
          format: "date"
        salary_cents:
          type: "integer"
          minimum: 0
