# معماری — تسک ۰۹: ماژول تنظیمات نوبت‌دهی ## ساختار فایل‌ها ``` src/Module/AppointmentSettings/ ├── Controller/ │ ├── WeeklyScheduleController.php │ ├── DateOverrideController.php │ └── HolidayController.php ├── Service/ │ ├── WeeklyScheduleService.php │ ├── DateOverrideService.php │ └── HolidayService.php ├── Repository/ │ ├── WeeklyScheduleRepository.php │ ├── DateOverrideRepository.php │ └── HolidayRepository.php ├── Entity/ │ ├── WeeklySchedule.php │ ├── DateOverride.php │ └── Holiday.php └── DTO/ ├── Request/ │ ├── CreateWeeklyScheduleRequest.php │ ├── CreateDateOverrideRequest.php │ └── CreateHolidayRequest.php └── Response/ ├── WeeklyScheduleResponse.php └── DateOverrideResponse.php ``` ## Entity: WeeklySchedule ```php #[ORM\Entity] #[ORM\Table(name: 'weekly_schedules')] class WeeklySchedule { #[ORM\Id, ORM\GeneratedValue, ORM\Column] private int $id; #[ORM\Column(type: UuidType::NAME, unique: true)] private Uuid $uuid; #[ORM\OneToOne(targetEntity: Doctor::class)] private Doctor $doctor; // هر روز هفته یک JSON: {active, slots: [{start, end, duration}]} #[ORM\Column(type: 'json')] private array $saturday = ['active' => false, 'slots' => []]; #[ORM\Column(type: 'json')] private array $sunday = ['active' => false, 'slots' => []]; #[ORM\Column(type: 'json')] private array $monday = ['active' => false, 'slots' => []]; #[ORM\Column(type: 'json')] private array $tuesday = ['active' => false, 'slots' => []]; #[ORM\Column(type: 'json')] private array $wednesday = ['active' => false, 'slots' => []]; #[ORM\Column(type: 'json')] private array $thursday = ['active' => false, 'slots' => []]; #[ORM\Column(type: 'json')] private array $friday = ['active' => false, 'slots' => []]; // TimestampableTrait } ``` ## Entity: DateOverride ```php #[ORM\Entity] #[ORM\Table(name: 'date_overrides')] class DateOverride { #[ORM\Id, ORM\GeneratedValue, ORM\Column] private int $id; #[ORM\Column(type: UuidType::NAME, unique: true)] private Uuid $uuid; #[ORM\ManyToOne(targetEntity: Doctor::class)] private Doctor $doctor; #[ORM\Column(type: 'date')] private \DateTimeInterface $date; #[ORM\Column(type: 'boolean', default: false)] private bool $active; #[ORM\Column(length: 200, nullable: true)] private ?string $reason; #[ORM\Column(type: 'json', nullable: true)] private ?array $customSlots; // [{start, end, duration}] // TimestampableTrait } ``` ## Entity: Holiday ```php #[ORM\Entity] #[ORM\Table(name: 'holidays')] class Holiday { #[ORM\Id, ORM\GeneratedValue, ORM\Column] private int $id; #[ORM\Column(type: UuidType::NAME, unique: true)] private Uuid $uuid; #[ORM\ManyToOne(targetEntity: Doctor::class)] private Doctor $doctor; #[ORM\Column(type: 'date')] private \DateTimeInterface $startDate; #[ORM\Column(type: 'date')] private \DateTimeInterface $endDate; #[ORM\Column(length: 200, nullable: true)] private ?string $reason; // TimestampableTrait } ```