<% if (isModelBaseBuiltin) { -%>
import {<%= modelBaseClass %>, model, property<%if (locals.relationImports) {%><% relationImports.forEach((relation) => {-%>, <%= relation %> <%_})-%><%}%>} from '@loopback/repository';
<% } else { -%>
import {model, property<%if (locals.relationImports) {%><% relationImports.forEach((relation) => {-%> , <%= relation %> <%_})-%><%}%>} from '@loopback/repository';
import {<%= modelBaseClass %>} from '.';
<% } -%>
<%_ if (locals.relationDestinationImports && locals.relationDestinationImports.length > 0) { -%>
import {<% relationDestinationImports.forEach((model, index) => {-%><%= model %><%if (index!==relationDestinationImports.length-1) {%>,<% } %> <%_}) -%>} from '.';
<%_ } -%>

<% if (modelSettings) { -%>
@model(<%- modelSettings %>)
<% } else { -%>
@model()
<% } -%>
export class <%= className %> extends <%= modelBaseClass %> {
<% Object.entries(properties).forEach(([key, val]) => { -%>
<% if (val.relation) { -%>
  @<%= val.relation.type %>(() => <%= val.relation.model %>)
<% } else { -%>
  @property({
  <%_ Object.entries(val).forEach(([propKey, propVal]) => { -%>
  <%_ if (!['tsType', 'relation'].includes(propKey)) { -%>
    <%= propKey %>: <%- propVal %>,
  <%_ } -%>
  <%_ }) -%>
  })
<% } -%>
  <%= key %><%if (!val.required) {%>?<% } %>: <%= val.tsType %>;

<% }) -%>
<% if(allowAdditionalProperties) { -%>
  // Define well-known properties here

  // Indexer property to allow additional data
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  [prop: string]: any;
<% } -%>

  constructor(data?: Partial<<%= className %>>) {
    super(data);
  }
}

export interface <%= className %>Relations {
  // describe navigational properties here
}

export type <%= className %>WithRelations = <%= className %> & <%= className %>Relations;
