classDiagram

  class Member {
	  Long id
    String name
    Email email
    Password password
    ROLE role
    STATUS status
  }
  
  class Subscription { // 하연
	  Long id
	  PLANTYPE plan_type
	  String description
	  BigDecimal price
	  Integer period
	  int daily_limit
	  int self_made_model_num
  }
  
  class Member_Subscription {
	  Long id // 하연
	  Long member_id
	  Subscription subscription
	  STATUS status
	  Boolean auto_renewal
	  LocalDateTime started_at
	  LocalDateTime expires_at
	  LocalDateTime cancelled_at
	  Cancellation_reason cancellation_reason
	  BigDecimal paid_amount
	  Long payment_method_id
  }
  
  class Discount_Policy { // 하연
	  Long id
	  String name
	  DISCOUNT_TYPE discount_type
	  BigDecimal discount_value
	  
	  int min_subscription_months
	  int max_usage_per_user
	  
	  LocalDateTime valid_from
	  LocalDateTime valid_until
	  
	  Boolean is_active
  }
  
   class Coupon {
      Long id
      String coupon_code
      String name
      DISCOUNT_TYPE discount_type
      BigDecimal discount_value
      LocalDateTime valid_from     // 쿠폰 시작일
      LocalDateTime valid_until    // 쿠폰 만료일
      CouponStatus status          // ACTIVE, USED, EXPIRED, CANCELLED
      LocalDateTime used_at        // 사용된 시각
      Long used_by                 // 사용한 회원 ID
  }
  
  class AIModel {
	  Long id
	  String modelName
	  ModelMetadata model_metadata
	  OwnType own_type
	  Long owner_id
	  BigDecimal price
	  boolean is_public
  }
  
  class ModelStatistics {
	  AIModel model
	  Long usage_count
	  Long view_count
	  LocalDateTime last_updated
  }
  
  class File {
	  Long id
	  RELATIONTYPE relation_type // 어떤 도메인인지 구분
	  Long relation_id // 모델넘버
	  String file_url // firebase url
	  String file_name // 파일명
    FileType file_type; //이미지,영상 등 부류
  }
  
  class ModelReview { // 하연
	  Long id
	  Long reviewer_id
	  Long model_id
	  String content
	  Integer rating
	  ReviewStatus status
	  LocalDateTime created_at
  }
  
  class MemberPointBalance { // 하연
	  Member member
	  BigDecimal totalPoints
	  BigDecimal availablePoints // 즉시 사용 가능 (스팸 방지)
	  BigDecimal pendingPoints // 리뷰 작성 보상, 마켓플레이스 수수료 (환불 대응 기간)
	  BigDecimal reservedPoints // 구독 결제 재시도 대기 시 등
	  Long version // 동시성 제어
  }
  
  class PointTransaction { // 하연
	  Long id
	  Long member_id
	  TransactionDirection direction
	  TransactionType transaction_type
	  BigDecimal pointAmount
	  BigDecimal balanceBefore
	  private BigDecimal balanceAfter
	  RefererType referer_type
	  Long referer_id
  }
  
  class PointPolicy { // 하연
	  Long id
	  String name
	  PointPolicyType policyType // EARN, SPEND
	  RefererType referType // REVIEW, ORDER, STORE
	  BigDecimal pointAmount
	  Boolean isActive
	  Integer priority
	  LocalDateTime validFrom
	  LocalDateTime validTo
  }
  
 class Report {
  Long reportId
  Long memberId
  TARGET_TYPE target_type
  Long targetId
  String reasonDetail
  ModelReportStatus modelReportStatus
}

class AdResult {
	Long id
	Long aiModelId
	String prompt
}

  Member --> Member_Subscription
  Subscription --> Member_Subscription
  Member --> MemberPointBalance
  Member --> Payment
  Payment --> PointTransaction

API 요청 데이터

payload = {
    "prompt": prompt,
    "negative_prompt": negative_prompt,
    "width": width,
    "height": height,
    "steps": steps,
    "cfg_scale": cfg_scale,
    "sampler_index": "DPM++ 2M Karras",  # 샘플러
    "restore_faces": False,
    "tiling": False,
    "n_iter": 1,  # 배치 수
    "batch_size": 1,  # 배치 크기
    "seed": -1,  # 랜덤 시드
    "subseed": -1,
    "subseed_strength": 0,
    "seed_resize_from_h": -1,
    "seed_resize_from_w": -1,
    "enable_hr": False,  # 고해상도 비활성화
    "save_images": False,  # WebUI에서 자동 저장 비활성화
    "do_not_save_samples": True,
    "do_not_save_grid": True
}

CREATE TABLE model_report ( report_id BIGINT AUTO_INCREMENT PRIMARY KEY, -- 신고 PK model_id BIGINT NOT NULL, -- 신고 대상 BaseModel reporter_id BIGINT NOT NULL, -- 신고한 사용자 ID reason_detail VARCHAR(500), -- 상세 신고 내용 status ENUM('PENDING', 'IN_PROGRESS', 'RESOLVED', 'REJECTED') DEFAULT 'PENDING', -- 신고 처리 상태 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 신고 생성일 processed_at TIMESTAMP NULL, -- 처리 완료일

CONSTRAINT fk_model_report_model
    FOREIGN KEY (model_id) REFERENCES base_model(id)

);