// `name` (the display/variant name) is never accepted from the client — it's
// always computed server-side from the selected masters, see
// product.service.ts's resolveVariantName()/buildVariantName().
const productProperties = {
  item_id: { type: 'string', minLength: 1 },
  metal_type_id: { type: 'string', nullable: true },
  purity_id: { type: 'string', nullable: true },
  category_id: { type: 'string', nullable: true },
  size_id: { type: 'string', nullable: true },
  weight_id: { type: 'string', nullable: true },
  wire_size_id: { type: 'string', nullable: true },
  hook_id: { type: 'string', nullable: true },
  endcap_id: { type: 'string', nullable: true },
  huid: { type: 'string', nullable: true },
};

export const createProductSchema = {
  body: {
    type: 'object',
    required: ['item_id'],
    properties: productProperties,
  },
};

export const updateProductSchema = {
  body: {
    type: 'object',
    properties: productProperties,
  },
};
