import SwiftUI

// MARK: - Single Checkmark (Delivered)

/// Single checkmark shape — identical path to left checkmark in DoubleCheckmarkShape.
/// Filled bezier path with rounded caps built into the curves.
/// ViewBox: 0 0 16.4 12 (same coordinate space as double, cropped to single).
struct SingleCheckmarkShape: Shape {
    func path(in rect: CGRect) -> Path {
        let sx = rect.width / 16.4
        let sy = rect.height / 12.0

        var path = Path()

        path.move(to: CGPoint(x: 16.0745 * sx, y: 1.13501 * sy))
        path.addCurve(
            to: CGPoint(x: 16.0378 * sx, y: 0.180235 * sy),
            control1: CGPoint(x: 16.3354 * sx, y: 0.86165 * sy),
            control2: CGPoint(x: 16.3191 * sx, y: 0.433785 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 15.0553 * sx, y: 0.21589 * sy),
            control1: CGPoint(x: 15.7565 * sx, y: -0.0733151 * sy),
            control2: CGPoint(x: 15.3162 * sx, y: -0.0574685 * sy)
        )
        path.addLine(to: CGPoint(x: 5.40975 * sx, y: 10.3103 * sy))
        path.addLine(to: CGPoint(x: 1.21886 * sx, y: 5.56025 * sy))
        path.addCurve(
            to: CGPoint(x: 0.240444 * sx, y: 5.48894 * sy),
            control1: CGPoint(x: 0.97018 * sx, y: 5.27897 * sy),
            control2: CGPoint(x: 0.533969 * sx, y: 5.24727 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 0.167063 * sx, y: 6.43975 * sy),
            control1: CGPoint(x: -0.049005 * sx, y: 5.7306 * sy),
            control2: CGPoint(x: -0.0816189 * sx, y: 6.15451 * sy)
        )
        path.addLine(to: CGPoint(x: 4.86346 * sx, y: 11.7643 * sy))
        path.addCurve(
            to: CGPoint(x: 5.37713 * sx, y: 11.998 * sy),
            control1: CGPoint(x: 4.98984 * sx, y: 11.9109 * sy),
            control2: CGPoint(x: 5.17737 * sx, y: 11.9941 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 5.89895 * sx, y: 11.7841 * sy),
            control1: CGPoint(x: 5.57281 * sx, y: 12.002 * sy),
            control2: CGPoint(x: 5.76442 * sx, y: 11.9228 * sy)
        )
        path.addLine(to: CGPoint(x: 16.0745 * sx, y: 1.13501 * sy))
        path.closeSubpath()

        return path
    }
}

// MARK: - Double Checkmarks (Read)

/// Double checkmark shape for read status.
/// Exact SVG path from design — two overlapping checkmarks.
/// Original viewBox: 0 0 22 12, fill-rule: evenodd.
struct DoubleCheckmarkShape: Shape {
    func path(in rect: CGRect) -> Path {
        let sx = rect.width / 22.0
        let sy = rect.height / 12.0

        var path = Path()

        // Left checkmark
        path.move(to: CGPoint(x: 16.0745 * sx, y: 1.13501 * sy))
        path.addCurve(
            to: CGPoint(x: 16.0378 * sx, y: 0.180235 * sy),
            control1: CGPoint(x: 16.3354 * sx, y: 0.86165 * sy),
            control2: CGPoint(x: 16.3191 * sx, y: 0.433785 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 15.0553 * sx, y: 0.21589 * sy),
            control1: CGPoint(x: 15.7565 * sx, y: -0.0733151 * sy),
            control2: CGPoint(x: 15.3162 * sx, y: -0.0574685 * sy)
        )
        path.addLine(to: CGPoint(x: 5.40975 * sx, y: 10.3103 * sy))
        path.addLine(to: CGPoint(x: 1.21886 * sx, y: 5.56025 * sy))
        path.addCurve(
            to: CGPoint(x: 0.240444 * sx, y: 5.48894 * sy),
            control1: CGPoint(x: 0.97018 * sx, y: 5.27897 * sy),
            control2: CGPoint(x: 0.533969 * sx, y: 5.24727 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 0.167063 * sx, y: 6.43975 * sy),
            control1: CGPoint(x: -0.049005 * sx, y: 5.7306 * sy),
            control2: CGPoint(x: -0.0816189 * sx, y: 6.15451 * sy)
        )
        path.addLine(to: CGPoint(x: 4.86346 * sx, y: 11.7643 * sy))
        path.addCurve(
            to: CGPoint(x: 5.37713 * sx, y: 11.998 * sy),
            control1: CGPoint(x: 4.98984 * sx, y: 11.9109 * sy),
            control2: CGPoint(x: 5.17737 * sx, y: 11.9941 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 5.89895 * sx, y: 11.7841 * sy),
            control1: CGPoint(x: 5.57281 * sx, y: 12.002 * sy),
            control2: CGPoint(x: 5.76442 * sx, y: 11.9228 * sy)
        )
        path.addLine(to: CGPoint(x: 16.0745 * sx, y: 1.13501 * sy))
        path.closeSubpath()

        // Right checkmark
        path.move(to: CGPoint(x: 21.8145 * sx, y: 1.13501 * sy))
        path.addCurve(
            to: CGPoint(x: 21.7778 * sx, y: 0.180235 * sy),
            control1: CGPoint(x: 22.0754 * sx, y: 0.86165 * sy),
            control2: CGPoint(x: 22.0591 * sx, y: 0.433785 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 20.7953 * sx, y: 0.21589 * sy),
            control1: CGPoint(x: 21.4965 * sx, y: -0.0733151 * sy),
            control2: CGPoint(x: 21.0563 * sx, y: -0.0574685 * sy)
        )
        path.addLine(to: CGPoint(x: 10.6198 * sx, y: 10.865 * sy))
        path.addCurve(
            to: CGPoint(x: 10.6565 * sx, y: 11.8198 * sy),
            control1: CGPoint(x: 10.3589 * sx, y: 11.1383 * sy),
            control2: CGPoint(x: 10.3752 * sx, y: 11.5662 * sy)
        )
        path.addCurve(
            to: CGPoint(x: 11.639 * sx, y: 11.7841 * sy),
            control1: CGPoint(x: 10.9378 * sx, y: 12.0733 * sy),
            control2: CGPoint(x: 11.3781 * sx, y: 12.0575 * sy)
        )
        path.addLine(to: CGPoint(x: 21.8145 * sx, y: 1.13501 * sy))
        path.closeSubpath()

        return path
    }
}
