
// Define the Feathers schema for service `panoHotspots`. (Can be re-generated.)
// !code: imports // !end
// !code: init // !end

// Define the model using JSON-schema
let schema = {
  // !<DEFAULT> code: schema_header
  title: 'PanoHotspots',
  description: 'PanoHotspots database.',
  // !end
  // !code: schema_definitions // !end

  // Required fields.
  required: [
    // !code: schema_required
    'type',
    'envPanoId',
    'panoId',
    'percentX',
    'percentY'
    // !end
  ],
  // Fields with unique values.
  uniqueItemProperties: [
    // !code: schema_unique // !end
  ],

  // Fields in the model.
  properties: {
    // !code: schema_properties
    type: {
      type: 'string',
      enum: [ 'pano', 'link', 'infobox' ]
    },
    envPanoId: {
      type: 'ID'
    },
    panoId: {
      type: 'ID'
    },
    targetPanoId: {
      type: 'ID'
    },
    infoboxId: {
      type: 'ID'
    },
    hotspotIconId: {
      type: 'ID'
    },
    hotspotIconSize: {
      type: 'number',
      faker: {
        exp: 'ctx.faker.random.number({min: 1, max: 10})'
      }
    },
    linkMeta: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          faker: 'image.imageUrl'
        },
        target: {
          type: 'string',
          enum: [ '', 'current', 'blank' ],
          default: ''
        }
      },
    },
    percentX: {
      type: 'number',
      faker: {
        exp: 'ctx.faker.random.number({min: 0, max: 100})'
      }
    },
    percentY: {
      type: 'number',
      faker: {
        exp: 'ctx.faker.random.number({min: 0, max: 100})'
      }
    },
    coordinates: {
      type: 'array',
      items: {
        type: 'number'
      }
    }
    // !end
  },
  // !code: schema_more // !end
}

// Define optional, non-JSON-schema extensions.
let extensions = {
  // GraphQL generation.
  graphql: {
    // !code: graphql_header
    name: 'PanoHotspot',
    service: {
      sort: { _id: 1 },
    },
    // sql: {
    //   sqlTable: 'PanoHotspots',
    //   uniqueKey: '_id',
    //   sqlColumn: {
    //     __authorId__: '__author_id__',
    //   },
    // },
    // !end
    discard: [
      // !code: graphql_discard // !end
    ],
    add: {
      // !<DEFAULT> code: graphql_add
      // __author__: { type: '__User__!', args: false, relation: { ourTable: '__authorId__', otherTable: '_id' } },
      // !end
    },
    // !code: graphql_more // !end
  },
}

// !code: more // !end

let moduleExports = {
  schema,
  extensions,
  // !code: moduleExports // !end
}

// !code: exports // !end
module.exports = moduleExports

// !code: funcs // !end
// !code: end // !end
