namespace MyParking.Shared
{
    // 单车车体系在车队坐标系中的固定位姿。
    public readonly struct VehicleLayout
    {
        public VehicleLayout(int vehicleId, Pose2D poseInFleet)
        {
            VehicleId = vehicleId;
            PoseInFleet = poseInFleet;
        }

        public int VehicleId { get; }

        public Pose2D PoseInFleet { get; }
    }

    // 车队参考点及该点在车队坐标系中表达的刚体速度。
    public readonly struct FleetMotionCommand
    {
        public FleetMotionCommand(
            Point2D referencePointInFleet,
            Twist2D twistAtReferencePoint)
        {
            ReferencePointInFleet = referencePointInFleet;
            TwistAtReferencePoint = twistAtReferencePoint;
        }

        public Point2D ReferencePointInFleet { get; }

        public Twist2D TwistAtReferencePoint { get; }

        public static FleetMotionCommand RotateAround(
            Point2D rotationCenterInFleet,
            double omegaRadiansPerSecond)
        {
            return new FleetMotionCommand(
                rotationCenterInFleet,
                new Twist2D(
                    0.0,
                    0.0,
                    omegaRadiansPerSecond));
        }

        public static FleetMotionCommand Stop()
        {
            return new FleetMotionCommand(
                Point2D.Zero,
                Twist2D.Zero);
        }
    }

    // 分配给指定车辆、在该车车体系中表达的刚体速度。
    public readonly struct FleetMemberCommand
    {
        public FleetMemberCommand(
            int vehicleId,
            Twist2D twistInVehicleBody)
        {
            VehicleId = vehicleId;
            TwistInVehicleBody = twistInVehicleBody;
        }

        public int VehicleId { get; }

        public Twist2D TwistInVehicleBody { get; }
    }
}
