using System;
using System.Drawing;

namespace AGVMapEditor.Models
{
    /// <summary>
    /// 맵 라벨 정보를 관리하는 클래스
    /// 디자인 요소용 텍스트 라벨
    /// </summary>
    public class MapLabel
    {
        /// <summary>
        /// 라벨 고유 ID
        /// </summary>
        public string LabelId { get; set; } = string.Empty;

        /// <summary>
        /// 라벨 텍스트
        /// </summary>
        public string Text { get; set; } = string.Empty;

        /// <summary>
        /// 맵 상의 위치 좌표
        /// </summary>
        public Point Position { get; set; } = Point.Empty;

        /// <summary>
        /// 폰트 정보
        /// </summary>
        public string FontFamily { get; set; } = "Arial";

        /// <summary>
        /// 폰트 크기
        /// </summary>
        public float FontSize { get; set; } = 12;

        /// <summary>
        /// 폰트 스타일 (Bold, Italic 등)
        /// </summary>
        public FontStyle FontStyle { get; set; } = FontStyle.Regular;

        /// <summary>
        /// 글자 색상
        /// </summary>
        public Color ForeColor { get; set; } = Color.Black;

        /// <summary>
        /// 배경 색상
        /// </summary>
        public Color BackColor { get; set; } = Color.Transparent;

        /// <summary>
        /// 배경 표시 여부
        /// </summary>
        public bool ShowBackground { get; set; } = false;

        /// <summary>
        /// 라벨 생성 일자
        /// </summary>
        public DateTime CreatedDate { get; set; } = DateTime.Now;

        /// <summary>
        /// 라벨 수정 일자
        /// </summary>
        public DateTime ModifiedDate { get; set; } = DateTime.Now;

        /// <summary>
        /// 라벨 활성화 여부
        /// </summary>
        public bool IsActive { get; set; } = true;

        /// <summary>
        /// 기본 생성자
        /// </summary>
        public MapLabel()
        {
        }

        /// <summary>
        /// 매개변수 생성자
        /// </summary>
        /// <param name="labelId">라벨 ID</param>
        /// <param name="text">라벨 텍스트</param>
        /// <param name="position">위치</param>
        public MapLabel(string labelId, string text, Point position)
        {
            LabelId = labelId;
            Text = text;
            Position = position;
            CreatedDate = DateTime.Now;
            ModifiedDate = DateTime.Now;
        }

        /// <summary>
        /// 문자열 표현
        /// </summary>
        public override string ToString()
        {
            return $"{LabelId}: {Text} at ({Position.X}, {Position.Y})";
        }

        /// <summary>
        /// 라벨 복사
        /// </summary>
        /// <returns>복사된 라벨</returns>
        public MapLabel Clone()
        {
            return new MapLabel
            {
                LabelId = LabelId,
                Text = Text,
                Position = Position,
                FontFamily = FontFamily,
                FontSize = FontSize,
                FontStyle = FontStyle,
                ForeColor = ForeColor,
                BackColor = BackColor,
                ShowBackground = ShowBackground,
                CreatedDate = CreatedDate,
                ModifiedDate = ModifiedDate,
                IsActive = IsActive
            };
        }
    }
}