Files
sam-api/app/Http/Controllers/Api/V1/Schemas/ModelParameterSchemas.php

107 lines
5.7 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Api\V1\Schemas;
use OpenApi\Attributes as OA;
/**
* Model Parameter related Swagger schemas
*/
#[OA\Schema(
schema: 'ModelParameterResource',
description: 'Model parameter resource',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'model_id', type: 'integer', example: 1),
new OA\Property(property: 'name', type: 'string', example: 'W0'),
new OA\Property(property: 'label', type: 'string', example: '가로 크기'),
new OA\Property(property: 'type', type: 'string', enum: ['INPUT', 'OUTPUT'], example: 'INPUT'),
new OA\Property(property: 'data_type', type: 'string', enum: ['INTEGER', 'DECIMAL', 'STRING', 'BOOLEAN'], example: 'DECIMAL'),
new OA\Property(property: 'unit', type: 'string', nullable: true, example: 'mm'),
new OA\Property(property: 'default_value', type: 'string', nullable: true, example: '1000'),
new OA\Property(property: 'min_value', type: 'number', nullable: true, example: 500),
new OA\Property(property: 'max_value', type: 'number', nullable: true, example: 2000),
new OA\Property(
property: 'enum_values',
type: 'array',
items: new OA\Items(type: 'string'),
nullable: true,
example: ['A', 'B', 'C']
),
new OA\Property(property: 'validation_rules', type: 'string', nullable: true, example: 'required|numeric|min:500'),
new OA\Property(property: 'description', type: 'string', nullable: true, example: '제품의 가로 크기를 입력하세요'),
new OA\Property(property: 'is_required', type: 'boolean', example: true),
new OA\Property(property: 'display_order', type: 'integer', example: 1),
new OA\Property(property: 'created_at', type: 'string', format: 'date-time', example: '2024-01-01T00:00:00Z'),
new OA\Property(property: 'updated_at', type: 'string', format: 'date-time', example: '2024-01-01T00:00:00Z')
]
)]
class ModelParameterResource {}
#[OA\Schema(
schema: 'CreateModelParameterRequest',
description: 'Request schema for creating model parameter',
required: ['name', 'label', 'type', 'data_type'],
properties: [
new OA\Property(
property: 'name',
type: 'string',
maxLength: 50,
example: 'W0',
description: 'Parameter name (alphanumeric with underscore, must start with letter)'
),
new OA\Property(property: 'label', type: 'string', maxLength: 100, example: '가로 크기'),
new OA\Property(property: 'type', type: 'string', enum: ['INPUT', 'OUTPUT'], example: 'INPUT'),
new OA\Property(property: 'data_type', type: 'string', enum: ['INTEGER', 'DECIMAL', 'STRING', 'BOOLEAN'], example: 'DECIMAL'),
new OA\Property(property: 'unit', type: 'string', maxLength: 20, nullable: true, example: 'mm'),
new OA\Property(property: 'default_value', type: 'string', maxLength: 255, nullable: true, example: '1000'),
new OA\Property(property: 'min_value', type: 'number', nullable: true, example: 500),
new OA\Property(property: 'max_value', type: 'number', nullable: true, example: 2000),
new OA\Property(
property: 'enum_values',
type: 'array',
items: new OA\Items(type: 'string'),
nullable: true,
example: ['A', 'B', 'C']
),
new OA\Property(property: 'validation_rules', type: 'string', maxLength: 500, nullable: true, example: 'required|numeric|min:500'),
new OA\Property(property: 'description', type: 'string', maxLength: 500, nullable: true, example: '제품의 가로 크기를 입력하세요'),
new OA\Property(property: 'is_required', type: 'boolean', example: true),
new OA\Property(property: 'display_order', type: 'integer', minimum: 0, example: 1)
]
)]
class CreateModelParameterRequest {}
#[OA\Schema(
schema: 'UpdateModelParameterRequest',
description: 'Request schema for updating model parameter',
properties: [
new OA\Property(
property: 'name',
type: 'string',
maxLength: 50,
example: 'W0',
description: 'Parameter name (alphanumeric with underscore, must start with letter)'
),
new OA\Property(property: 'label', type: 'string', maxLength: 100, example: '가로 크기'),
new OA\Property(property: 'type', type: 'string', enum: ['INPUT', 'OUTPUT'], example: 'INPUT'),
new OA\Property(property: 'data_type', type: 'string', enum: ['INTEGER', 'DECIMAL', 'STRING', 'BOOLEAN'], example: 'DECIMAL'),
new OA\Property(property: 'unit', type: 'string', maxLength: 20, nullable: true, example: 'mm'),
new OA\Property(property: 'default_value', type: 'string', maxLength: 255, nullable: true, example: '1000'),
new OA\Property(property: 'min_value', type: 'number', nullable: true, example: 500),
new OA\Property(property: 'max_value', type: 'number', nullable: true, example: 2000),
new OA\Property(
property: 'enum_values',
type: 'array',
items: new OA\Items(type: 'string'),
nullable: true,
example: ['A', 'B', 'C']
),
new OA\Property(property: 'validation_rules', type: 'string', maxLength: 500, nullable: true, example: 'required|numeric|min:500'),
new OA\Property(property: 'description', type: 'string', maxLength: 500, nullable: true, example: '제품의 가로 크기를 입력하세요'),
new OA\Property(property: 'is_required', type: 'boolean', example: true),
new OA\Property(property: 'display_order', type: 'integer', minimum: 0, example: 1)
]
)]
class UpdateModelParameterRequest {}