Files
sam-api/app/Swagger/v1/ModelSetApi.php

494 lines
22 KiB
PHP
Raw Normal View History

<?php
namespace App\Swagger\v1;
/**
* @OA\Tag(
* name="ModelSet",
* description="모델셋 관리 (견적 카테고리 기반)"
* )
*/
/**
* =========================
* Domain 스키마
* =========================
*
* @OA\Schema(
* schema="ModelSet",
* type="object",
* description="모델셋 (견적 카테고리)",
* required={"id","code","name"},
*
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="parent_id", type="integer", nullable=true, example=null),
* @OA\Property(property="code_group", type="string", example="estimate"),
* @OA\Property(property="code", type="string", example="screen_product"),
* @OA\Property(property="name", type="string", example="스크린 제품"),
* @OA\Property(property="description", type="string", nullable=true, example="스크린 제품군 모델셋"),
* @OA\Property(property="level", type="integer", example=2),
* @OA\Property(property="sort_order", type="integer", example=1),
* @OA\Property(property="profile_code", type="string", example="custom_category"),
* @OA\Property(property="is_active", type="boolean", example=true),
* @OA\Property(property="fields", type="array", @OA\Items(ref="#/components/schemas/ModelSetField")),
* @OA\Property(property="children", type="array", @OA\Items(ref="#/components/schemas/ModelSet")),
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-01-01 10:00:00"),
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-01-01 10:00:00")
* )
*
* @OA\Schema(
* schema="ModelSetField",
* type="object",
* description="모델셋 필드 정의",
*
* @OA\Property(property="key", type="string", example="open_width"),
* @OA\Property(property="name", type="string", example="열림폭"),
* @OA\Property(property="type", type="string", example="number"),
* @OA\Property(property="required", type="boolean", example=true),
* @OA\Property(property="order", type="integer", example=1),
* @OA\Property(property="default", type="string", nullable=true, example="1000"),
* @OA\Property(property="options", type="object", nullable=true, example=null),
* @OA\Property(property="description", type="string", nullable=true, example="제품 열림폭 (mm)")
* )
*
* @OA\Schema(
* schema="ModelSetDetail",
* type="object",
* description="모델셋 상세 정보",
*
* @OA\Property(property="category", ref="#/components/schemas/ModelSet"),
* @OA\Property(property="products", type="array", @OA\Items(type="object")),
* @OA\Property(property="models", type="array", @OA\Items(type="object")),
* @OA\Property(property="field_schema", type="array", @OA\Items(ref="#/components/schemas/ModelSetField"))
* )
*
* @OA\Schema(
* schema="ModelSetCreateRequest",
* type="object",
* required={"code","name"},
*
* @OA\Property(property="parent_id", type="integer", nullable=true, example=null),
* @OA\Property(property="code", type="string", example="new_product"),
* @OA\Property(property="name", type="string", example="신규 제품군"),
* @OA\Property(property="description", type="string", nullable=true, example="신규 제품군 설명"),
* @OA\Property(property="level", type="integer", example=2),
* @OA\Property(property="sort_order", type="integer", example=10),
* @OA\Property(property="profile_code", type="string", example="custom_category"),
* @OA\Property(property="is_active", type="boolean", example=true),
* @OA\Property(property="fields", type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(property="key", type="string", example="width"),
* @OA\Property(property="name", type="string", example=""),
* @OA\Property(property="type", type="string", example="number"),
* @OA\Property(property="required", type="boolean", example=true),
* @OA\Property(property="order", type="integer", example=1),
* @OA\Property(property="default", type="string", nullable=true),
* @OA\Property(property="options", type="object", nullable=true),
* @OA\Property(property="description", type="string", nullable=true)
* )
* ),
* @OA\Property(property="create_model", type="boolean", example=false, description="기본 모델 및 BOM 템플릿 생성 여부"),
* @OA\Property(property="model_data", type="object", nullable=true,
* @OA\Property(property="code", type="string", example="NEW_MODEL"),
* @OA\Property(property="name", type="string", example="신규 모델"),
* @OA\Property(property="description", type="string", nullable=true)
* )
* )
*
* @OA\Schema(
* schema="ModelSetUpdateRequest",
* type="object",
*
* @OA\Property(property="name", type="string", example="수정된 제품군"),
* @OA\Property(property="description", type="string", nullable=true, example="수정된 설명"),
* @OA\Property(property="sort_order", type="integer", example=5),
* @OA\Property(property="is_active", type="boolean", example=true),
* @OA\Property(property="fields", type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(property="key", type="string"),
* @OA\Property(property="name", type="string"),
* @OA\Property(property="type", type="string"),
* @OA\Property(property="required", type="boolean"),
* @OA\Property(property="order", type="integer"),
* @OA\Property(property="default", type="string", nullable=true),
* @OA\Property(property="options", type="object", nullable=true),
* @OA\Property(property="description", type="string", nullable=true)
* )
* )
* )
*
* @OA\Schema(
* schema="ModelSetCloneRequest",
* type="object",
* required={"code","name"},
*
* @OA\Property(property="code", type="string", example="cloned_product"),
* @OA\Property(property="name", type="string", example="복제된 제품군"),
* @OA\Property(property="description", type="string", nullable=true, example="복제된 설명"),
* @OA\Property(property="sort_order", type="integer", example=999),
* @OA\Property(property="is_active", type="boolean", example=true)
* )
*
* @OA\Schema(
* schema="ModelSetEstimateParameters",
* type="object",
* description="견적 파라미터 정보",
*
* @OA\Property(property="category", type="object",
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="name", type="string", example="스크린 제품"),
* @OA\Property(property="code", type="string", example="screen_product")
* ),
* @OA\Property(property="input_fields", type="array",
*
* @OA\Items(ref="#/components/schemas/ModelSetField")
* ),
*
* @OA\Property(property="calculated_fields", type="array",
*
* @OA\Items(type="object",
*
* @OA\Property(property="key", type="string", example="make_width"),
* @OA\Property(property="name", type="string", example="제작폭"),
* @OA\Property(property="type", type="string", example="number"),
* @OA\Property(property="description", type="string", nullable=true)
* )
* ),
* @OA\Property(property="calculation_schema", type="object", example={"size_calculation": "kyungdong_screen_size"})
* )
*
* @OA\Schema(
* schema="ModelSetBomCalculationRequest",
* type="object",
* description="BOM 계산 요청 파라미터",
*
* @OA\Property(property="open_width", type="number", example=1500, description="열림폭 (mm)"),
* @OA\Property(property="open_height", type="number", example=2000, description="열림높이 (mm)"),
* @OA\Property(property="quantity", type="integer", example=1, description="수량"),
* @OA\Property(property="model_name", type="string", nullable=true, example="스크린A"),
* @OA\Property(property="guide_rail_type", type="string", nullable=true, example="standard"),
* @OA\Property(property="shutter_box", type="string", nullable=true, example="type_a")
* )
*
* @OA\Schema(
* schema="ModelSetBomCalculationResult",
* type="object",
* description="BOM 계산 결과",
*
* @OA\Property(property="calculated_values", type="object",
* @OA\Property(property="make_width", type="number", example=1530),
* @OA\Property(property="make_height", type="number", example=2050),
* @OA\Property(property="calculated_area", type="number", example=3.14),
* @OA\Property(property="calculated_weight", type="number", example=45.5),
* @OA\Property(property="motor_capacity", type="string", example="0.5HP"),
* @OA\Property(property="motor_bracket_size", type="string", example="M-100")
* ),
* @OA\Property(property="bom_items", type="array",
*
* @OA\Items(type="object",
*
* @OA\Property(property="material_code", type="string", example="MAT001"),
* @OA\Property(property="material_name", type="string", example="알루미늄 프레임"),
* @OA\Property(property="quantity", type="number", example=2),
* @OA\Property(property="unit", type="string", example="EA"),
* @OA\Property(property="unit_price", type="number", example=15000),
* @OA\Property(property="total_price", type="number", example=30000)
* )
* ),
* @OA\Property(property="total_cost", type="number", example=500000)
* )
*/
class ModelSetApi
{
/**
* @OA\Get(
* path="/api/v1/model-sets",
* summary="모델셋 목록 조회",
* description="견적 카테고리 기반 모델셋 목록을 조회합니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="category_type", in="query", description="카테고리 유형", @OA\Schema(type="string", example="screen_product")),
* @OA\Parameter(name="is_active", in="query", description="활성화 여부", @OA\Schema(type="boolean", example=true)),
*
* @OA\Response(response=200, description="모델셋 목록 조회 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 조회"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="model_sets", type="array", @OA\Items(ref="#/components/schemas/ModelSet"))
* )
* )
* )
* )
*/
public function index() {}
/**
* @OA\Get(
* path="/api/v1/model-sets/{id}",
* summary="모델셋 상세 조회",
* description="모델셋의 상세 정보(카테고리, 제품, 모델, 필드 스키마)를 조회합니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\Response(response=200, description="모델셋 상세 조회 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 조회"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="model_set", ref="#/components/schemas/ModelSetDetail")
* )
* )
* ),
*
* @OA\Response(response=404, description="모델셋 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function show() {}
/**
* @OA\Post(
* path="/api/v1/model-sets",
* summary="모델셋 생성",
* description="새로운 모델셋(견적 카테고리)을 생성합니다. 옵션으로 기본 모델 및 BOM 템플릿도 함께 생성할 수 있습니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ModelSetCreateRequest")),
*
* @OA\Response(response=200, description="모델셋 생성 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 생성"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="model_set", ref="#/components/schemas/ModelSetDetail")
* )
* )
* ),
*
* @OA\Response(response=422, description="검증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function store() {}
/**
* @OA\Put(
* path="/api/v1/model-sets/{id}",
* summary="모델셋 수정",
* description="모델셋 정보를 수정합니다. 필드 배열이 전달되면 기존 필드를 삭제하고 새로 생성합니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ModelSetUpdateRequest")),
*
* @OA\Response(response=200, description="모델셋 수정 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 수정"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="model_set", ref="#/components/schemas/ModelSetDetail")
* )
* )
* ),
*
* @OA\Response(response=404, description="모델셋 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=422, description="검증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function update() {}
/**
* @OA\Delete(
* path="/api/v1/model-sets/{id}",
* summary="모델셋 삭제",
* description="모델셋을 삭제합니다. 연관된 제품이나 하위 카테고리가 있으면 삭제할 수 없습니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\Response(response=200, description="모델셋 삭제 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 삭제")
* )
* ),
*
* @OA\Response(response=404, description="모델셋 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=400, description="삭제 불가 (연관 데이터 존재)", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function destroy() {}
/**
* @OA\Post(
* path="/api/v1/model-sets/{id}/clone",
* summary="모델셋 복제",
* description="기존 모델셋을 복제하여 새로운 모델셋을 생성합니다. 필드 정의도 함께 복제됩니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="복제할 모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ModelSetCloneRequest")),
*
* @OA\Response(response=200, description="모델셋 복제 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="모델셋 복제 완료"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="model_set", ref="#/components/schemas/ModelSetDetail")
* )
* )
* ),
*
* @OA\Response(response=404, description="원본 모델셋 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=422, description="검증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function clone() {}
/**
* @OA\Get(
* path="/api/v1/model-sets/{id}/fields",
* summary="모델셋 필드 구조 조회",
* description="모델셋의 카테고리별 필드 구조(스키마)를 조회합니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\Response(response=200, description="필드 구조 조회 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 조회"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="category_fields", type="array", @OA\Items(ref="#/components/schemas/ModelSetField"))
* )
* )
* ),
*
* @OA\Response(response=404, description="모델셋 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function fields() {}
/**
* @OA\Get(
* path="/api/v1/model-sets/{id}/bom-templates",
* summary="모델셋 BOM 템플릿 목록",
* description="모델셋과 연관된 모델들의 BOM 템플릿 목록을 조회합니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\Response(response=200, description="BOM 템플릿 목록 조회 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 조회"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="bom_templates", type="array",
*
* @OA\Items(type="object",
*
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="model_version_id", type="integer", example=1),
* @OA\Property(property="name", type="string", example="스크린 기본 BOM"),
* @OA\Property(property="company_type", type="string", example="경동기업"),
* @OA\Property(property="formula_version", type="string", example="v1.0"),
* @OA\Property(property="calculation_schema", type="object")
* )
* )
* )
* )
* ),
*
* @OA\Response(response=404, description="모델셋 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function bomTemplates() {}
/**
* @OA\Get(
* path="/api/v1/model-sets/{id}/estimate-parameters",
* summary="견적 파라미터 조회",
* description="모델셋의 견적 계산에 필요한 입력 파라미터와 계산 결과 필드를 조회합니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\Response(response=200, description="견적 파라미터 조회 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="데이터 조회"),
* @OA\Property(property="data", type="object",
* @OA\Property(property="parameters", ref="#/components/schemas/ModelSetEstimateParameters")
* )
* )
* ),
*
* @OA\Response(response=404, description="모델셋 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function estimateParameters() {}
/**
* @OA\Post(
* path="/api/v1/model-sets/{id}/calculate-bom",
* summary="BOM 계산",
* description="입력 파라미터를 기반으로 BOM을 계산합니다. 크기 계산, 자재 수량 산출, 비용 계산이 수행됩니다.",
* tags={"ModelSet"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="모델셋(카테고리) ID", @OA\Schema(type="integer", example=1)),
*
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ModelSetBomCalculationRequest")),
*
* @OA\Response(response=200, description="BOM 계산 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="계산 완료"),
* @OA\Property(property="data", ref="#/components/schemas/ModelSetBomCalculationResult")
* )
* ),
*
* @OA\Response(response=404, description="모델셋 또는 BOM 템플릿 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=422, description="검증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function calculateBom() {}
}