{
  "modelspec": "1.0-draft",
  "module": {
    "id": "github.com/demo-db/chinook/model/chinook",
    "name": "chinook",
    "version": "0.1.0"
  },
  "entities": {
    "Artist": {
      "key": [
        "ArtistId"
      ],
      "properties": {
        "ArtistId": {
          "type": "int",
          "required": true
        },
        "Name": {
          "type": "string",
          "max_len": 120
        }
      }
    },
    "Album": {
      "key": [
        "AlbumId"
      ],
      "properties": {
        "AlbumId": {
          "type": "int",
          "required": true
        },
        "Title": {
          "type": "string",
          "required": true,
          "max_len": 160
        },
        "ArtistId": {
          "entity": "Artist",
          "required": true
        }
      }
    },
    "Track": {
      "key": [
        "TrackId"
      ],
      "properties": {
        "TrackId": {
          "type": "int",
          "required": true
        },
        "Name": {
          "type": "string",
          "required": true,
          "max_len": 200
        },
        "AlbumId": {
          "entity": "Album"
        },
        "MediaTypeId": {
          "entity": "MediaType",
          "required": true
        },
        "GenreId": {
          "entity": "Genre"
        },
        "Composer": {
          "type": "string",
          "max_len": 220
        },
        "Milliseconds": {
          "type": "int",
          "required": true
        },
        "Bytes": {
          "type": "int"
        },
        "UnitPrice": {
          "type": "decimal",
          "required": true
        }
      }
    },
    "Genre": {
      "key": [
        "GenreId"
      ],
      "properties": {
        "GenreId": {
          "type": "int",
          "required": true
        },
        "Name": {
          "type": "string",
          "max_len": 120
        }
      }
    },
    "MediaType": {
      "key": [
        "MediaTypeId"
      ],
      "properties": {
        "MediaTypeId": {
          "type": "int",
          "required": true
        },
        "Name": {
          "type": "string",
          "max_len": 120
        }
      }
    },
    "Playlist": {
      "key": [
        "PlaylistId"
      ],
      "properties": {
        "PlaylistId": {
          "type": "int",
          "required": true
        },
        "Name": {
          "type": "string",
          "max_len": 120
        }
      }
    },
    "PlaylistTrack": {
      "key": [
        "PlaylistId",
        "TrackId"
      ],
      "properties": {
        "PlaylistId": {
          "entity": "Playlist",
          "required": true
        },
        "TrackId": {
          "entity": "Track",
          "required": true
        }
      }
    },
    "Customer": {
      "key": [
        "CustomerId"
      ],
      "properties": {
        "CustomerId": {
          "type": "int",
          "required": true
        },
        "FirstName": {
          "type": "string",
          "required": true,
          "max_len": 40
        },
        "LastName": {
          "type": "string",
          "required": true,
          "max_len": 20
        },
        "Company": {
          "type": "string",
          "max_len": 80
        },
        "Address": {
          "type": "string",
          "max_len": 70
        },
        "City": {
          "type": "string",
          "max_len": 40
        },
        "State": {
          "type": "string",
          "max_len": 40
        },
        "Country": {
          "type": "string",
          "max_len": 40
        },
        "PostalCode": {
          "type": "string",
          "max_len": 10
        },
        "Phone": {
          "type": "string",
          "max_len": 24
        },
        "Fax": {
          "type": "string",
          "max_len": 24
        },
        "Email": {
          "type": "string",
          "required": true,
          "max_len": 60,
          "format": "email"
        },
        "SupportRepId": {
          "entity": "Employee"
        }
      }
    },
    "Employee": {
      "key": [
        "EmployeeId"
      ],
      "properties": {
        "EmployeeId": {
          "type": "int",
          "required": true
        },
        "LastName": {
          "type": "string",
          "required": true,
          "max_len": 20
        },
        "FirstName": {
          "type": "string",
          "required": true,
          "max_len": 20
        },
        "Title": {
          "type": "string",
          "max_len": 30
        },
        "ReportsTo": {
          "entity": "Employee"
        },
        "BirthDate": {
          "type": "datetime"
        },
        "HireDate": {
          "type": "datetime"
        },
        "Address": {
          "type": "string",
          "max_len": 70
        },
        "City": {
          "type": "string",
          "max_len": 40
        },
        "State": {
          "type": "string",
          "max_len": 40
        },
        "Country": {
          "type": "string",
          "max_len": 40
        },
        "PostalCode": {
          "type": "string",
          "max_len": 10
        },
        "Phone": {
          "type": "string",
          "max_len": 24
        },
        "Fax": {
          "type": "string",
          "max_len": 24
        },
        "Email": {
          "type": "string",
          "max_len": 60,
          "format": "email"
        }
      }
    },
    "Invoice": {
      "key": [
        "InvoiceId"
      ],
      "properties": {
        "InvoiceId": {
          "type": "int",
          "required": true
        },
        "CustomerId": {
          "entity": "Customer",
          "required": true
        },
        "InvoiceDate": {
          "type": "datetime",
          "required": true
        },
        "BillingAddress": {
          "type": "string",
          "max_len": 70
        },
        "BillingCity": {
          "type": "string",
          "max_len": 40
        },
        "BillingState": {
          "type": "string",
          "max_len": 40
        },
        "BillingCountry": {
          "type": "string",
          "max_len": 40
        },
        "BillingPostalCode": {
          "type": "string",
          "max_len": 10
        },
        "Total": {
          "type": "decimal",
          "required": true
        }
      }
    },
    "InvoiceLine": {
      "key": [
        "InvoiceLineId"
      ],
      "properties": {
        "InvoiceLineId": {
          "type": "int",
          "required": true
        },
        "InvoiceId": {
          "entity": "Invoice",
          "required": true
        },
        "TrackId": {
          "entity": "Track",
          "required": true
        },
        "UnitPrice": {
          "type": "decimal",
          "required": true
        },
        "Quantity": {
          "type": "int",
          "required": true
        }
      }
    }
  }
}
