| | 211 | ---- |
| | 212 | {{{vet_clinic_applications}}} |
| | 213 | [[BR]] |
| | 214 | Represents the application a veterinary clinic submits before being approved to operate in the system.Keeping applications in a separate table supports an approval workflow without overloading the main {{{vet_clinics}}} entity. |
| | 215 | [[BR]] |
| | 216 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 217 | * {{{application_id}}} – surrogate numeric identifier (chosen primary key). |
| | 218 | * {{{clinic_id}}} – unique natural identifier per clinic; one clinic can have at most one application record (as enforced by UNIQUE). |
| | 219 | * {{{application_id}}} is chosen as PK because it is stable and independent of workflow or business changes; {{{clinic_id}}} remains a unique alternate key for enforcing one-application-per-clinic in this design. |
| | 220 | [[BR]] |
| | 221 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 222 | * {{{application_id}}} – numeric, required. Auto-generated positive integer; primary key. |
| | 223 | * {{{clinic_id}}} – numeric, required. Unique; identifies the clinic that submitted the application. |
| | 224 | * {{{name}}} – text, required. Clinic name as submitted; max length ~120. |
| | 225 | * {{{email}}} – text, optional. Contact email as submitted; max length ~254; email format validation. |
| | 226 | * {{{phone}}} – text, optional. Contact phone number as submitted; max length ~40. |
| | 227 | * {{{city}}} – text, required. City of the clinic; max length ~80. |
| | 228 | * {{{address}}} – text, required. Street address; max length ~200. |
| | 229 | * {{{submitted_at}}} – datetime, required. Timestamp when the application was submitted; defaults to NOW(). |
| | 230 | * {{{status}}} – text, required. Workflow state; defaults to 'PENDING'. Allowed values: 'PENDING', 'APPROVED', 'DENIED'. |
| | 231 | * {{{reviewed_at}}} – datetime, optional. When the application was reviewed (approved/denied). |
| | 232 | * {{{reviewed_by}}} – numeric, optional. Admin who reviewed the application; can be NULL if reviewer is removed. |
| | 233 | * {{{denial_reason}}} – text, optional. Explanation recorded only when status is 'DENIED'. |
| | 234 | ---- |
| | 235 | {{{favorite_listings}}} |
| | 236 | [[BR]] |
| | 237 | Represents a many-to-many relationship between clients and listings, capturing which listings a client has marked as “favorite”. |
| | 238 | [[BR]] |
| | 239 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 240 | * {{{(client_id, listing_id)}}} – composite natural key (chosen primary key). |
| | 241 | The composite key is chosen as PK because a favorite is uniquely defined by “which client favorited which listing” and no additional surrogate identifier is needed. |
| | 242 | [[BR]] |
| | 243 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 244 | * {{{client_id}}} – numeric, required. Identifies the client who favorites the listing. |
| | 245 | * {{{listing_id}}} – numeric, required. Identifies the favorited listing. |